diff --git a/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt b/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt index bcbf757ad0..1b561f7990 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt @@ -62,7 +62,9 @@ class CallProximityManager @Inject constructor( */ fun stop() { sensorManager.unregisterListener(this) - wakeLock?.release() + wakeLock + ?.takeIf { it.isHeld } + ?.release() } override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) { @@ -91,6 +93,8 @@ class CallProximityManager @Inject constructor( } private fun onProximityFar() { - wakeLock?.release() + wakeLock + ?.takeIf { it.isHeld } + ?.release() } }