Do not turn screen on automatically for calls.

This commit is contained in:
Clark 2023-12-06 08:37:33 -05:00 committed by GitHub
parent befa396e82
commit 7ce2991b0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink;
import org.thoughtcrime.securesms.events.WebRtcViewModel;
import org.thoughtcrime.securesms.ringrtc.CameraState;
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState;
@ -27,7 +28,11 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
Log.i(tag, "handleAudioDeviceChanged(): active: " + activeDevice + " available: " + availableDevices);
if (!currentState.getLocalDeviceState().getCameraState().isEnabled()) {
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context));
if (currentState.getCallInfoState().getCallState() == WebRtcViewModel.State.CALL_CONNECTED) {
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context));
} else {
Log.i(tag, "handleAudioDeviceChanged(): call not connected, not updating phone state");
}
}
return currentState.builder()

View file

@ -183,10 +183,10 @@ public class IncomingCallActionProcessor extends DeviceAwareActionProcessor {
CallTable.Direction.INCOMING,
CallTable.Event.ONGOING);
webRtcInteractor.updatePhoneState(LockManager.PhoneState.INTERACTIVE);
boolean shouldDisturbUserWithCall = DoNotDisturbUtil.shouldDisturbUserWithCall(context.getApplicationContext(), recipient);
if (shouldDisturbUserWithCall) {
webRtcInteractor.updatePhoneState(LockManager.PhoneState.INTERACTIVE);
boolean started = webRtcInteractor.startWebRtcCallActivityIfPossible();
if (!started) {
Log.i(TAG, "Unable to start call activity due to OS version or not being in the foreground");

View file

@ -120,11 +120,11 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
currentState = WebRtcVideoUtil.initializeVideo(context, webRtcInteractor.getCameraEventListener(), currentState, RemotePeer.GROUP_CALL_ID.longValue());
webRtcInteractor.setCallInProgressNotification(TYPE_INCOMING_RINGING, remotePeerGroup, true);
webRtcInteractor.updatePhoneState(LockManager.PhoneState.INTERACTIVE);
webRtcInteractor.initializeAudioForCall();
boolean shouldDisturbUserWithCall = DoNotDisturbUtil.shouldDisturbUserWithCall(context.getApplicationContext());
if (shouldDisturbUserWithCall) {
webRtcInteractor.updatePhoneState(LockManager.PhoneState.INTERACTIVE);
boolean started = webRtcInteractor.startWebRtcCallActivityIfPossible();
if (!started) {
Log.i(TAG, "Unable to start call activity due to OS version or not being in the foreground");