Try to workaround race condition on slow phones that may happen with foreground service notification not displayed in time

This commit is contained in:
Sylvain Berfini 2026-01-09 10:53:07 +01:00
parent 01a51574c3
commit 5d584abe33

View file

@ -502,25 +502,20 @@ class NotificationsManager
Log.i("$TAG Service has been started")
inCallService = service
coreContext.postOnCoreThread { core ->
if (core.callsNb == 0) {
Log.w("$TAG No call anymore, stopping service")
if (waitForInCallServiceForegroundToStopIt) {
Log.w("$TAG Service wasn't started as foreground yet, doing it now using a dummy notification")
showDummyNotificationForCallService()
}
if (inCallServiceForegroundNotificationPublished) {
stopInCallForegroundService()
} else {
Log.w("$TAG Foreground service notification wasn't published, shouldn't happen")
}
} else if (currentInCallServiceNotificationId == -1) {
coreContext.postOnCoreThread { core ->
if (core.callsNb >= 1 && currentInCallServiceNotificationId == -1) {
val call = core.currentCall ?: core.calls.first()
Log.i(
"$TAG At least one call is running and no foreground Service notification was found, starting it using call [${call.remoteAddress.asStringUriOnly()}]"
)
Log.i("$TAG No notification found for this call, creating one now")
showCallNotification(call, LinphoneUtils.isCallIncoming(call.state))
}
}