diff --git a/app/src/main/java/org/linphone/activities/voip/viewmodels/ControlsViewModel.kt b/app/src/main/java/org/linphone/activities/voip/viewmodels/ControlsViewModel.kt index fc8b58bb4..e295a4b1d 100644 --- a/app/src/main/java/org/linphone/activities/voip/viewmodels/ControlsViewModel.kt +++ b/app/src/main/java/org/linphone/activities/voip/viewmodels/ControlsViewModel.kt @@ -555,6 +555,13 @@ class ControlsViewModel : ViewModel() { } private fun shouldProximitySensorBeEnabled(): Boolean { + if (forceDisableProximitySensor.value == true) { + Log.i( + "[Call Controls] Forcing proximity sensor to be disabled (usually in incoming/outgoing call fragments)" + ) + return false + } + val currentCall = coreContext.core.currentCall ?: coreContext.core.calls.firstOrNull() if (currentCall != null) { when (val state = currentCall.state) { @@ -574,11 +581,7 @@ class ControlsViewModel : ViewModel() { } } - if (forceDisableProximitySensor.value == true) { - Log.i( - "[Call Controls] Forcing proximity sensor to be disabled (usually in incoming/outgoing call fragments)" - ) - } else if (isVideoEnabled.value == true) { + if (isVideoEnabled.value == true) { Log.i( "[Call Controls] Active call current params says video is enabled, proximity sensor will be disabled" ) @@ -588,8 +591,7 @@ class ControlsViewModel : ViewModel() { ) } - return forceDisableProximitySensor.value == false && - !(isVideoEnabled.value ?: false) && + return !(isVideoEnabled.value ?: false) && !(nonEarpieceOutputAudioDevice.value ?: false) } }