kopia lustrzana https://github.com/ryukoposting/Signal-Android
Ensure correct local device rotation information is retained when starting a call.
rodzic
149c138666
commit
290f84e5b1
|
@ -651,7 +651,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
|||
|
||||
@Override
|
||||
public void onFullyInitialized() {
|
||||
process((s, p) -> p.handleOrientationChanged(s, false, s.getLocalDeviceState().getOrientation().getDegrees()));
|
||||
process((s, p) -> p.handleOrientationChanged(s, s.getLocalDeviceState().isLandscapeEnabled(), s.getLocalDeviceState().getDeviceOrientation().getDegrees()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -461,8 +461,8 @@ public abstract class WebRtcActionProcessor {
|
|||
camera.setOrientation(orientationDegrees);
|
||||
}
|
||||
|
||||
int sinkRotationDegrees = isLandscapeEnabled ? BroadcastVideoSink.DEVICE_ROTATION_IGNORE : orientationDegrees;
|
||||
int stateRotationDegrees = isLandscapeEnabled ? 0 : orientationDegrees;
|
||||
int sinkRotationDegrees = isLandscapeEnabled ? BroadcastVideoSink.DEVICE_ROTATION_IGNORE : orientationDegrees;
|
||||
int stateRotationDegrees = isLandscapeEnabled ? 0 : orientationDegrees;
|
||||
|
||||
BroadcastVideoSink sink = currentState.getVideoState().getLocalSink();
|
||||
if (sink != null) {
|
||||
|
@ -476,6 +476,8 @@ public abstract class WebRtcActionProcessor {
|
|||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.setOrientation(Orientation.fromDegrees(stateRotationDegrees))
|
||||
.setLandscapeEnabled(isLandscapeEnabled)
|
||||
.setDeviceOrientation(Orientation.fromDegrees(orientationDegrees))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,26 +14,32 @@ public final class LocalDeviceState {
|
|||
boolean bluetoothAvailable;
|
||||
boolean wantsBluetooth;
|
||||
Orientation orientation;
|
||||
boolean isLandscapeEnabled;
|
||||
Orientation deviceOrientation;
|
||||
|
||||
LocalDeviceState() {
|
||||
this(CameraState.UNKNOWN, true, false, false, Orientation.PORTRAIT_BOTTOM_EDGE);
|
||||
this(CameraState.UNKNOWN, true, false, false, Orientation.PORTRAIT_BOTTOM_EDGE, false, Orientation.PORTRAIT_BOTTOM_EDGE);
|
||||
}
|
||||
|
||||
LocalDeviceState(@NonNull LocalDeviceState toCopy) {
|
||||
this(toCopy.cameraState, toCopy.microphoneEnabled, toCopy.bluetoothAvailable, toCopy.wantsBluetooth, toCopy.orientation);
|
||||
this(toCopy.cameraState, toCopy.microphoneEnabled, toCopy.bluetoothAvailable, toCopy.wantsBluetooth, toCopy.orientation, toCopy.isLandscapeEnabled, toCopy.deviceOrientation);
|
||||
}
|
||||
|
||||
LocalDeviceState(@NonNull CameraState cameraState,
|
||||
boolean microphoneEnabled,
|
||||
boolean bluetoothAvailable,
|
||||
boolean wantsBluetooth,
|
||||
@NonNull Orientation orientation)
|
||||
@NonNull Orientation orientation,
|
||||
boolean isLandscapeEnabled,
|
||||
@NonNull Orientation deviceOrientation)
|
||||
{
|
||||
this.cameraState = cameraState;
|
||||
this.microphoneEnabled = microphoneEnabled;
|
||||
this.bluetoothAvailable = bluetoothAvailable;
|
||||
this.wantsBluetooth = wantsBluetooth;
|
||||
this.orientation = orientation;
|
||||
this.isLandscapeEnabled = isLandscapeEnabled;
|
||||
this.deviceOrientation = deviceOrientation;
|
||||
}
|
||||
|
||||
public @NonNull CameraState getCameraState() {
|
||||
|
@ -55,4 +61,12 @@ public final class LocalDeviceState {
|
|||
public @NonNull Orientation getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public boolean isLandscapeEnabled() {
|
||||
return isLandscapeEnabled;
|
||||
}
|
||||
|
||||
public @NonNull Orientation getDeviceOrientation() {
|
||||
return deviceOrientation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,16 @@ public class WebRtcServiceStateBuilder {
|
|||
toBuild.orientation = orientation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public @NonNull LocalDeviceStateBuilder setLandscapeEnabled(boolean isLandscapeEnabled) {
|
||||
toBuild.isLandscapeEnabled = isLandscapeEnabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
public @NonNull LocalDeviceStateBuilder setDeviceOrientation(@NonNull Orientation deviceOrientation) {
|
||||
toBuild.deviceOrientation = deviceOrientation;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public class CallSetupStateBuilder {
|
||||
|
|
Ładowanie…
Reference in New Issue