AOD: Show keyguard while dozing but not locked

Fixes an issue where AOD would not work correctly between screen
off and when the keyguard actually locked.

Fixes: 30017474
Test: Settings > Security > Gear, set lock device after 30s, disable "lock immediately on power key", turn phone off, try double tap. should work without having to wait 30s
Change-Id: Ifa88e35a821b86a2ed8117ed8a63fc51b5304121
This commit is contained in:
Adrian Roos
2017-04-19 16:59:09 -07:00
parent 1d5ceb538a
commit 087826ad11
2 changed files with 46 additions and 7 deletions

View File

@@ -709,6 +709,8 @@ public class StatusBar extends SystemUI implements DemoMode,
private KeyguardMonitorImpl mKeyguardMonitor;
private BatteryController mBatteryController;
private boolean mPanelExpanded;
private boolean mKeyguardRequested;
private boolean mIsKeyguard;
private LogMaker mStatusBarStateLog;
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private NotificationIconAreaController mNotificationIconAreaController;
@@ -4022,6 +4024,30 @@ public class StatusBar extends SystemUI implements DemoMode,
}
public void showKeyguard() {
mKeyguardRequested = true;
updateIsKeyguard();
}
public boolean hideKeyguard() {
mKeyguardRequested = false;
return updateIsKeyguard();
}
private boolean updateIsKeyguard() {
// For dozing, keyguard needs to be shown whenever the device is non-interactive. Otherwise
// there's no surface we can show to the user.
boolean keyguardForDozing = mDozingRequested && !mDeviceInteractive;
boolean shouldBeKeyguard = mKeyguardRequested || keyguardForDozing;
if (shouldBeKeyguard && !mIsKeyguard) {
showKeyguardImpl();
} else if (!shouldBeKeyguard && mIsKeyguard) {
return hideKeyguardImpl();
}
return false;
}
public void showKeyguardImpl() {
mIsKeyguard = true;
if (mLaunchTransitionFadingAway) {
mNotificationPanel.animate().cancel();
onLaunchTransitionFadingEnded();
@@ -4175,7 +4201,8 @@ public class StatusBar extends SystemUI implements DemoMode,
/**
* @return true if we would like to stay in the shade, false if it should go away entirely
*/
public boolean hideKeyguard() {
public boolean hideKeyguardImpl() {
mIsKeyguard = false;
Trace.beginSection("StatusBar#hideKeyguard");
boolean staying = mLeaveOpenOnKeyguardHide;
setBarState(StatusBarState.SHADE);
@@ -4854,6 +4881,7 @@ public class StatusBar extends SystemUI implements DemoMode,
}
});
}
updateIsKeyguard();
}
public void onStartedWakingUp() {
@@ -4862,6 +4890,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mVisualStabilityManager.setScreenOn(true);
mNotificationPanel.setTouchDisabled(false);
updateVisibleToUser();
updateIsKeyguard();
}
public void onScreenTurningOn() {
@@ -4976,6 +5005,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|| mFingerprintUnlockController.getMode()
== FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
mStatusBarWindowManager.setDozing(mDozing);
mStatusBarKeyguardViewManager.setDozing(mDozing);
updateDozingState();
Trace.endSection();
}

View File

@@ -84,6 +84,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
protected boolean mShowing;
protected boolean mOccluded;
protected boolean mRemoteInputActive;
private boolean mDozing;
protected boolean mFirstUpdate = true;
protected boolean mLastShowing;
@@ -91,6 +92,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private boolean mLastBouncerShowing;
private boolean mLastBouncerDismissible;
protected boolean mLastRemoteInputActive;
private boolean mLastDozing;
private OnDismissAction mAfterKeyguardGoneAction;
private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
@@ -239,6 +241,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
updateStates();
}
public void setDozing(boolean dozing) {
mDozing = dozing;
updateStates();
}
public void onScreenTurnedOff() {
mScreenTurnedOn = false;
mStatusBar.onScreenTurnedOff();
@@ -481,11 +488,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private long getNavBarShowDelay() {
if (mStatusBar.isKeyguardFadingAway()) {
return mStatusBar.getKeyguardFadingAwayDelay();
} else {
// Keyguard is not going away, thus we are showing the navigation bar because the
// bouncer is appearing.
} else if (mBouncer.isShowing()) {
return NAV_BAR_SHOW_DELAY_BOUNCER;
} else {
// No longer dozing, or remote input is active. No delay.
return 0;
}
}
@@ -553,6 +560,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mLastBouncerShowing = bouncerShowing;
mLastBouncerDismissible = bouncerDismissible;
mLastRemoteInputActive = remoteInputActive;
mLastDozing = mDozing;
mStatusBar.onKeyguardViewManagerStatesUpdated();
}
@@ -561,14 +569,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* @return Whether the navigation bar should be made visible based on the current state.
*/
protected boolean isNavBarVisible() {
return !(mShowing && !mOccluded) || mBouncer.isShowing() || mRemoteInputActive;
return !(mShowing && !mOccluded) && !mDozing || mBouncer.isShowing() || mRemoteInputActive;
}
/**
* @return Whether the navigation bar was made visible based on the last known state.
*/
protected boolean getLastNavBarVisible() {
return !(mLastShowing && !mLastOccluded) || mLastBouncerShowing || mLastRemoteInputActive;
return !(mLastShowing && !mLastOccluded) && !mLastDozing || mLastBouncerShowing
|| mLastRemoteInputActive;
}
public boolean shouldDismissOnMenuPressed() {