mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-21 11:38:36 +00:00
Remove restriction on proximity lock in landscape calling.
This commit is contained in:
committed by
Jeffrey Starke
parent
dfdadc9d7a
commit
8992ed047d
@@ -24,7 +24,6 @@ import org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper;
|
|||||||
import org.thoughtcrime.securesms.components.webrtc.GroupCallSafetyNumberChangeNotificationUtil;
|
import org.thoughtcrime.securesms.components.webrtc.GroupCallSafetyNumberChangeNotificationUtil;
|
||||||
import org.thoughtcrime.securesms.database.CallTable;
|
import org.thoughtcrime.securesms.database.CallTable;
|
||||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
|
||||||
import org.thoughtcrime.securesms.events.CallParticipant;
|
import org.thoughtcrime.securesms.events.CallParticipant;
|
||||||
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
||||||
import org.thoughtcrime.securesms.groups.GroupId;
|
import org.thoughtcrime.securesms.groups.GroupId;
|
||||||
@@ -618,10 +617,6 @@ public abstract class WebRtcActionProcessor {
|
|||||||
callParticipant.getVideoSink().setDeviceOrientationDegrees(sinkRotationDegrees);
|
callParticipant.getVideoSink().setDeviceOrientationDegrees(sinkRotationDegrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppDependencies.getSignalCallManager()
|
|
||||||
.getLockManager()
|
|
||||||
.updateOrientation(Orientation.fromDegrees(orientationDegrees));
|
|
||||||
|
|
||||||
return currentState.builder()
|
return currentState.builder()
|
||||||
.changeLocalDeviceState()
|
.changeLocalDeviceState()
|
||||||
.setOrientation(Orientation.fromDegrees(stateRotationDegrees))
|
.setOrientation(Orientation.fromDegrees(stateRotationDegrees))
|
||||||
|
|||||||
@@ -3,12 +3,8 @@ package org.thoughtcrime.securesms.webrtc.locks;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.provider.Settings;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
import org.thoughtcrime.securesms.components.sensors.Orientation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintains wake lock state.
|
* Maintains wake lock state.
|
||||||
@@ -19,14 +15,11 @@ public class LockManager {
|
|||||||
|
|
||||||
private static final String TAG = Log.tag(LockManager.class);
|
private static final String TAG = Log.tag(LockManager.class);
|
||||||
|
|
||||||
private final PowerManager.WakeLock fullLock;
|
private final PowerManager.WakeLock fullLock;
|
||||||
private final PowerManager.WakeLock partialLock;
|
private final PowerManager.WakeLock partialLock;
|
||||||
private final WifiManager.WifiLock wifiLock;
|
private final WifiManager.WifiLock wifiLock;
|
||||||
private final ProximityLock proximityLock;
|
private final ProximityLock proximityLock;
|
||||||
|
|
||||||
|
|
||||||
private PhoneState phoneState = PhoneState.IDLE;
|
|
||||||
private Orientation orientation = Orientation.PORTRAIT_BOTTOM_EDGE;
|
|
||||||
private boolean proximityDisabled = false;
|
private boolean proximityDisabled = false;
|
||||||
|
|
||||||
public enum PhoneState {
|
public enum PhoneState {
|
||||||
@@ -60,25 +53,14 @@ public class LockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateInCallLockState() {
|
private void updateInCallLockState() {
|
||||||
if (orientation == Orientation.PORTRAIT_BOTTOM_EDGE && !proximityDisabled) {
|
if (!proximityDisabled) {
|
||||||
setLockState(LockState.PROXIMITY);
|
setLockState(LockState.PROXIMITY);
|
||||||
} else {
|
} else {
|
||||||
setLockState(LockState.FULL);
|
setLockState(LockState.FULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateOrientation(@NonNull Orientation orientation) {
|
|
||||||
Log.d(TAG, "Update orientation: " + orientation);
|
|
||||||
this.orientation = orientation;
|
|
||||||
|
|
||||||
if (phoneState == PhoneState.IN_CALL || phoneState == PhoneState.IN_VIDEO) {
|
|
||||||
updateInCallLockState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updatePhoneState(PhoneState state) {
|
public void updatePhoneState(PhoneState state) {
|
||||||
this.phoneState = state;
|
|
||||||
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case IDLE:
|
case IDLE:
|
||||||
setLockState(LockState.SLEEP);
|
setLockState(LockState.SLEEP);
|
||||||
|
|||||||
Reference in New Issue
Block a user