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