mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Disable proximity lock when local video is enabled
Fixes #6179 // FREEBIE
This commit is contained in:
parent
a075bf7505
commit
eddb97013a
@ -26,12 +26,14 @@ public class LockManager {
|
|||||||
|
|
||||||
|
|
||||||
private int orientation = AccelerometerListener.ORIENTATION_UNKNOWN;
|
private int orientation = AccelerometerListener.ORIENTATION_UNKNOWN;
|
||||||
|
private boolean proximityDisabled = false;
|
||||||
|
|
||||||
public enum PhoneState {
|
public enum PhoneState {
|
||||||
IDLE,
|
IDLE,
|
||||||
PROCESSING, //used when the phone is active but before the user should be alerted.
|
PROCESSING, //used when the phone is active but before the user should be alerted.
|
||||||
INTERACTIVE,
|
INTERACTIVE,
|
||||||
IN_CALL,
|
IN_CALL,
|
||||||
|
IN_VIDEO
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum LockState {
|
private enum LockState {
|
||||||
@ -78,8 +80,7 @@ public class LockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateInCallLockState() {
|
private void updateInCallLockState() {
|
||||||
if (orientation != AccelerometerListener.ORIENTATION_HORIZONTAL
|
if (orientation != AccelerometerListener.ORIENTATION_HORIZONTAL && wifiLockEnforced && !proximityDisabled) {
|
||||||
&& wifiLockEnforced) {
|
|
||||||
setLockState(LockState.PROXIMITY);
|
setLockState(LockState.PROXIMITY);
|
||||||
} else {
|
} else {
|
||||||
setLockState(LockState.FULL);
|
setLockState(LockState.FULL);
|
||||||
@ -100,7 +101,13 @@ public class LockManager {
|
|||||||
setLockState(LockState.FULL);
|
setLockState(LockState.FULL);
|
||||||
accelerometerListener.enable(false);
|
accelerometerListener.enable(false);
|
||||||
break;
|
break;
|
||||||
|
case IN_VIDEO:
|
||||||
|
proximityDisabled = true;
|
||||||
|
accelerometerListener.enable(false);
|
||||||
|
updateInCallLockState();
|
||||||
|
break;
|
||||||
case IN_CALL:
|
case IN_CALL:
|
||||||
|
proximityDisabled = false;
|
||||||
accelerometerListener.enable(true);
|
accelerometerListener.enable(true);
|
||||||
updateInCallLockState();
|
updateInCallLockState();
|
||||||
break;
|
break;
|
||||||
|
@ -491,7 +491,9 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
|||||||
|
|
||||||
initializeAudio();
|
initializeAudio();
|
||||||
outgoingRinger.playComplete();
|
outgoingRinger.playComplete();
|
||||||
lockManager.updatePhoneState(LockManager.PhoneState.IN_CALL);
|
|
||||||
|
if (localVideoEnabled) lockManager.updatePhoneState(LockManager.PhoneState.IN_VIDEO);
|
||||||
|
else lockManager.updatePhoneState(LockManager.PhoneState.IN_CALL);
|
||||||
|
|
||||||
sendMessage(WebRtcViewModel.State.CALL_CONNECTED, recipient, localVideoEnabled, remoteVideoEnabled);
|
sendMessage(WebRtcViewModel.State.CALL_CONNECTED, recipient, localVideoEnabled, remoteVideoEnabled);
|
||||||
|
|
||||||
@ -664,6 +666,11 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
|||||||
.build().toByteArray()), false));
|
.build().toByteArray()), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (callState == CallState.STATE_CONNECTED) {
|
||||||
|
if (localVideoEnabled) this.lockManager.updatePhoneState(LockManager.PhoneState.IN_VIDEO);
|
||||||
|
else this.lockManager.updatePhoneState(LockManager.PhoneState.IN_CALL);
|
||||||
|
}
|
||||||
|
|
||||||
sendMessage(viewModelStateFor(callState), this.recipient, localVideoEnabled, remoteVideoEnabled);
|
sendMessage(viewModelStateFor(callState), this.recipient, localVideoEnabled, remoteVideoEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user