Fixed potential ANR when using auto answer

This commit is contained in:
Sylvain Berfini 2020-05-20 15:38:16 +02:00
parent 63a8fdd118
commit 1a1bfee678

View file

@ -142,13 +142,11 @@ class CoreContext(val context: Context, coreConfig: Config) {
Log.w("[Context] Auto answering call immediately")
answerCall(call)
} else {
val timer = Timer("Auto answer scheduler")
Log.i("[Context] Scheduling auto answering in $autoAnswerDelay milliseconds")
timer.schedule(object : TimerTask() {
override fun run() {
Log.w("[Context] Auto answering call")
answerCall(call)
}
val mainThreadHandler = Handler(Looper.getMainLooper())
mainThreadHandler.postDelayed({
Log.w("[Context] Auto answering call")
answerCall(call)
}, autoAnswerDelay.toLong())
}
}