Merge pull request #6627 from element-hq/feature/valere/call/fix_proximity_bug

Fix | When selecting earpiece twice in a row the proximity sensor get wrongly disabled
This commit is contained in:
Valere Fedronic 2026-04-21 13:52:32 +02:00 committed by GitHub
commit 7f198155f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()