mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-06 05:55:35 +01:00
Switch to speaker and disable proximity when screen sharing.
This commit is contained in:
committed by
Michelle Tang
parent
a0577cd8a2
commit
b2215915ef
+1
-1
@@ -86,7 +86,7 @@ public class ActiveCallActionProcessorDelegate extends WebRtcActionProcessor {
|
||||
.build();
|
||||
|
||||
if (currentState.getCallInfoState().getCallState() == WebRtcViewModel.State.CALL_CONNECTED) {
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled();
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled() || currentState.getLocalDeviceState().isScreenSharing();
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, localVideoEnabled, enable));
|
||||
}
|
||||
|
||||
|
||||
+21
-10
@@ -58,7 +58,7 @@ public class ConnectedCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
.cameraState(currentState.getVideoState().requireRouter().getCameraState())
|
||||
.build();
|
||||
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled();
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled() || currentState.getLocalDeviceState().isScreenSharing();
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, localVideoEnabled, remoteVideoEnabled));
|
||||
|
||||
@@ -155,11 +155,16 @@ public class ConnectedCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
return callFailure(currentState, "setVideoEnable() after screen share failed: ", e);
|
||||
}
|
||||
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(false)
|
||||
.setMediaProjectionIntent(null)
|
||||
.build();
|
||||
currentState = currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(false)
|
||||
.setMediaProjectionIntent(null)
|
||||
.build();
|
||||
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, cameraWasEnabled, remoteVideoEnabled));
|
||||
|
||||
return currentState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,10 +194,16 @@ public class ConnectedCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
}
|
||||
router.startScreenShare(mediaProjectionIntent);
|
||||
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(true)
|
||||
.build();
|
||||
currentState = currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(true)
|
||||
.build();
|
||||
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, true, remoteVideoEnabled));
|
||||
WebRtcUtil.enableSpeakerPhoneIfNeeded(webRtcInteractor, currentState);
|
||||
|
||||
return currentState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
|
||||
Log.i(tag, "handleAudioDeviceChanged(): active: " + activeDevice + " available: " + availableDevices);
|
||||
|
||||
if (currentState.getCallInfoState().getCallState() == WebRtcViewModel.State.CALL_CONNECTED) {
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled();
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled() || currentState.getLocalDeviceState().isScreenSharing();
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, localVideoEnabled, remoteVideoEnabled));
|
||||
} else {
|
||||
|
||||
+21
-10
@@ -105,7 +105,7 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
|
||||
.cameraState(router.getCameraState())
|
||||
.build();
|
||||
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled();
|
||||
boolean localVideoEnabled = currentState.getLocalDeviceState().getCameraState().isEnabled() || currentState.getLocalDeviceState().isScreenSharing();
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, localVideoEnabled, remoteVideoEnabled));
|
||||
|
||||
@@ -144,11 +144,16 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
|
||||
return groupCallFailure(currentState, "Unable to restore video mute after screen share", e);
|
||||
}
|
||||
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(false)
|
||||
.setMediaProjectionIntent(null)
|
||||
.build();
|
||||
currentState = currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(false)
|
||||
.setMediaProjectionIntent(null)
|
||||
.build();
|
||||
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, cameraWasEnabled, remoteVideoEnabled));
|
||||
|
||||
return currentState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,10 +185,16 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
|
||||
}
|
||||
router.startScreenShare(mediaProjectionIntent);
|
||||
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(true)
|
||||
.build();
|
||||
currentState = currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isScreenSharing(true)
|
||||
.build();
|
||||
|
||||
boolean remoteVideoEnabled = currentState.getCallInfoState().getRemoteCallParticipantsMap().values().stream().anyMatch(CallParticipant::isVideoEnabled);
|
||||
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context, true, remoteVideoEnabled));
|
||||
WebRtcUtil.enableSpeakerPhoneIfNeeded(webRtcInteractor, currentState);
|
||||
|
||||
return currentState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -86,7 +86,7 @@ public final class WebRtcUtil {
|
||||
}
|
||||
|
||||
public static void enableSpeakerPhoneIfNeeded(@NonNull WebRtcInteractor webRtcInteractor, WebRtcServiceState currentState) {
|
||||
if (!currentState.getLocalDeviceState().getCameraState().isEnabled()) {
|
||||
if (!currentState.getLocalDeviceState().getCameraState().isEnabled() && !currentState.getLocalDeviceState().isScreenSharing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user