From 74ef5fe60d07b508661a7cf877b040e73d203c3d Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 11 May 2026 17:14:09 +0300 Subject: [PATCH] Turn proximity sensing off immediately when last call is closed --- .../kotlin/com/tutpro/baresip/BaresipService.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 10610182..9ba45f32 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -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