From 18d4924171e0f1a62b89abcb8fe8184dacbe3930 Mon Sep 17 00:00:00 2001 From: Valere Date: Mon, 20 Apr 2026 11:24:38 +0200 Subject: [PATCH] fix: proximity sensor was wrongly disabled --- .../features/call/impl/utils/WebViewAudioManager.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt index c6e8557ff9..2d674d21af 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt @@ -366,9 +366,11 @@ class WebViewAudioManager( coroutineScope.launch { proximitySensorMutex.withLock { @Suppress("WakeLock", "WakeLockTimeout") - if (device?.type == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE && proximitySensorWakeLock?.isHeld == false) { - // If the device is the built-in earpiece, we need to acquire the proximity sensor wake lock - proximitySensorWakeLock?.acquire() + if (device?.type == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE) { + if (proximitySensorWakeLock?.isHeld == false) { + // If the device is the built-in earpiece, we need to acquire the proximity sensor wake lock + proximitySensorWakeLock?.acquire() + } } else if (proximitySensorWakeLock?.isHeld == true) { // If the device is no longer the earpiece, we need to release the wake lock proximitySensorWakeLock?.release()