mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
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:
+5
-3
@@ -366,9 +366,11 @@ class WebViewAudioManager(
|
|||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
proximitySensorMutex.withLock {
|
proximitySensorMutex.withLock {
|
||||||
@Suppress("WakeLock", "WakeLockTimeout")
|
@Suppress("WakeLock", "WakeLockTimeout")
|
||||||
if (device?.type == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE && proximitySensorWakeLock?.isHeld == false) {
|
if (device?.type == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE) {
|
||||||
// If the device is the built-in earpiece, we need to acquire the proximity sensor wake lock
|
if (proximitySensorWakeLock?.isHeld == false) {
|
||||||
proximitySensorWakeLock?.acquire()
|
// If the device is the built-in earpiece, we need to acquire the proximity sensor wake lock
|
||||||
|
proximitySensorWakeLock?.acquire()
|
||||||
|
}
|
||||||
} else if (proximitySensorWakeLock?.isHeld == true) {
|
} else if (proximitySensorWakeLock?.isHeld == true) {
|
||||||
// If the device is no longer the earpiece, we need to release the wake lock
|
// If the device is no longer the earpiece, we need to release the wake lock
|
||||||
proximitySensorWakeLock?.release()
|
proximitySensorWakeLock?.release()
|
||||||
|
|||||||
Reference in New Issue
Block a user