Fixed proximity sensor not disabled during incoming call

This commit is contained in:
Sylvain Berfini 2024-05-13 15:50:48 +02:00
parent cce13828d9
commit 0206753d78

View file

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