Prevent crash when removing service task if Core isn't alive
This commit is contained in:
parent
b9c178cc29
commit
f3ad232c1f
1 changed files with 11 additions and 9 deletions
|
@ -70,17 +70,19 @@ class CoreService : CoreService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||||
if (coreContext.core.callsNb > 0) {
|
if (LinphoneApplication.contextExists()) {
|
||||||
Log.w("[Service] Task removed but there is at least one active call, do not stop the Core!")
|
if (coreContext.core.callsNb > 0) {
|
||||||
} else if (!corePreferences.keepServiceAlive) {
|
Log.w("[Service] Task removed but there is at least one active call, do not stop the Core!")
|
||||||
if (coreContext.core.isInBackground) {
|
} else if (!corePreferences.keepServiceAlive) {
|
||||||
Log.i("[Service] Task removed, stopping Core")
|
if (coreContext.core.isInBackground) {
|
||||||
coreContext.stop()
|
Log.i("[Service] Task removed, stopping Core")
|
||||||
|
coreContext.stop()
|
||||||
|
} else {
|
||||||
|
Log.w("[Service] Task removed but Core is not in background, skipping")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w("[Service] Task removed but Core is not in background, skipping")
|
Log.i("[Service] Task removed but we were asked to keep the service alive, so doing nothing")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Log.i("[Service] Task removed but we were asked to keep the service alive, so doing nothing")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onTaskRemoved(rootIntent)
|
super.onTaskRemoved(rootIntent)
|
||||||
|
|
Loading…
Reference in a new issue