mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Try to workaround race condition on slow phones that may happen with foreground service notification not displayed in time
This commit is contained in:
parent
01a51574c3
commit
5d584abe33
1 changed files with 9 additions and 14 deletions
|
|
@ -502,25 +502,20 @@ class NotificationsManager
|
||||||
Log.i("$TAG Service has been started")
|
Log.i("$TAG Service has been started")
|
||||||
inCallService = service
|
inCallService = service
|
||||||
|
|
||||||
|
if (waitForInCallServiceForegroundToStopIt) {
|
||||||
|
Log.w("$TAG Service wasn't started as foreground yet, doing it now using a dummy notification")
|
||||||
|
showDummyNotificationForCallService()
|
||||||
|
}
|
||||||
|
if (inCallServiceForegroundNotificationPublished) {
|
||||||
|
stopInCallForegroundService()
|
||||||
|
}
|
||||||
|
|
||||||
coreContext.postOnCoreThread { core ->
|
coreContext.postOnCoreThread { core ->
|
||||||
if (core.callsNb == 0) {
|
if (core.callsNb >= 1 && currentInCallServiceNotificationId == -1) {
|
||||||
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) {
|
|
||||||
val call = core.currentCall ?: core.calls.first()
|
val call = core.currentCall ?: core.calls.first()
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG At least one call is running and no foreground Service notification was found, starting it using call [${call.remoteAddress.asStringUriOnly()}]"
|
"$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))
|
showCallNotification(call, LinphoneUtils.isCallIncoming(call.state))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue