Turn proximity sensing off immediately when last call is closed

This commit is contained in:
Juha Heinanen
2026-05-11 17:14:09 +03:00
parent d8334cba2d
commit 74ef5fe60d

View File

@ -1113,6 +1113,11 @@ class BaresipService: Service() {
if (call != null) {
call.terminated.value = true
call.remove()
if (!Call.inCall()) {
proximitySensing(false)
if (!telecom)
abandonAudioFocus(applicationContext)
}
}
ConnectionService.lastDisconnectTime = System.currentTimeMillis()
val connection = ConnectionService.connections[callp]
@ -1170,13 +1175,9 @@ class BaresipService: Service() {
val tone = ev[2]
if (tone == "busy")
playBusy()
else {
if (!telecom && !Call.inCall())
abandonAudioFocus(applicationContext)
ensureCommunicationMode()
}
if (!telecom && !Call.inCall())
abandonAudioFocus(applicationContext)
else
if (!Call.inCall())
ensureCommunicationMode()
if (call.dir == "out")
call.rejected = call.startTime == null &&
!reason.startsWith("408") &&
@ -2120,7 +2121,6 @@ class BaresipService: Service() {
}
if (!Call.calls().any { ConnectionService.connections.containsKey(it.callp) })
resetCallVolume()
proximitySensing(false)
}
}
cleanupRunnable = runnable