mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Implement initial support for foldables in calling.
This commit is contained in:
committed by
Greyson Parrelli
parent
927b6096c6
commit
5229e24397
@@ -168,8 +168,8 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
process((s, p) -> p.handleUpdateRenderedResolutions(s));
|
||||
}
|
||||
|
||||
public void orientationChanged(int degrees) {
|
||||
process((s, p) -> p.handleOrientationChanged(s, degrees));
|
||||
public void orientationChanged(boolean isLandscapeEnabled, int degrees) {
|
||||
process((s, p) -> p.handleOrientationChanged(s, isLandscapeEnabled, degrees));
|
||||
}
|
||||
|
||||
public void setAudioSpeaker(boolean isSpeaker) {
|
||||
@@ -649,7 +649,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
|
||||
@Override
|
||||
public void onFullyInitialized() {
|
||||
process((s, p) -> p.handleOrientationChanged(s, s.getLocalDeviceState().getOrientation().getDegrees()));
|
||||
process((s, p) -> p.handleOrientationChanged(s, false, s.getLocalDeviceState().getOrientation().getDegrees()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.signal.ringrtc.CallException;
|
||||
import org.signal.ringrtc.CallId;
|
||||
import org.signal.ringrtc.CallManager;
|
||||
import org.signal.ringrtc.GroupCall;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.sensors.Orientation;
|
||||
import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||
@@ -454,24 +455,27 @@ public abstract class WebRtcActionProcessor {
|
||||
return currentState;
|
||||
}
|
||||
|
||||
protected @NonNull WebRtcServiceState handleOrientationChanged(@NonNull WebRtcServiceState currentState, int orientationDegrees) {
|
||||
protected @NonNull WebRtcServiceState handleOrientationChanged(@NonNull WebRtcServiceState currentState, boolean isLandscapeEnabled, int orientationDegrees) {
|
||||
Camera camera = currentState.getVideoState().getCamera();
|
||||
if (camera != null) {
|
||||
camera.setOrientation(orientationDegrees);
|
||||
}
|
||||
|
||||
int sinkRotationDegrees = isLandscapeEnabled ? BroadcastVideoSink.DEVICE_ROTATION_IGNORE : orientationDegrees;
|
||||
int stateRotationDegrees = isLandscapeEnabled ? 0 : orientationDegrees;
|
||||
|
||||
BroadcastVideoSink sink = currentState.getVideoState().getLocalSink();
|
||||
if (sink != null) {
|
||||
sink.setDeviceOrientationDegrees(orientationDegrees);
|
||||
sink.setDeviceOrientationDegrees(sinkRotationDegrees);
|
||||
}
|
||||
|
||||
for (CallParticipant callParticipant : currentState.getCallInfoState().getRemoteCallParticipants()) {
|
||||
callParticipant.getVideoSink().setDeviceOrientationDegrees(orientationDegrees);
|
||||
callParticipant.getVideoSink().setDeviceOrientationDegrees(sinkRotationDegrees);
|
||||
}
|
||||
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.setOrientation(Orientation.fromDegrees(orientationDegrees))
|
||||
.setOrientation(Orientation.fromDegrees(stateRotationDegrees))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user