AOD: Never show bouncer when dozing
Fixes an issue where the bouncer was appearing on AOD under certain circumstances. To prevent that, delay showing the bouncer until we are no longer dozing or at least guaranteed to wake up. Change-Id: I0fa53616db09be98d33ea7d06b38d8ff3037707f Fixes: 64287908 Test: Go to AOD; adb shell service call window 42; verify that bouncer only comes up after waking up from AOD.
This commit is contained in:
@@ -102,6 +102,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
|
||||
private boolean mDeferScrimFadeOut;
|
||||
|
||||
// Dismiss action to be launched when we stop dozing or the keyguard is gone.
|
||||
private PendingDismissActionRequest mPendingDismissAction;
|
||||
|
||||
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
@@ -162,13 +165,18 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
} else {
|
||||
mStatusBar.showKeyguard();
|
||||
if (hideBouncerWhenShowing) {
|
||||
mBouncer.hide(false /* destroyView */);
|
||||
hideBouncer(false /* destroyView */);
|
||||
mBouncer.prepare();
|
||||
}
|
||||
}
|
||||
updateStates();
|
||||
}
|
||||
|
||||
private void hideBouncer(boolean destroyView) {
|
||||
mBouncer.hide(destroyView);
|
||||
cancelPendingDismissAction();
|
||||
}
|
||||
|
||||
private void showBouncer() {
|
||||
if (mShowing) {
|
||||
mBouncer.show(false /* resetSecuritySelection */);
|
||||
@@ -179,6 +187,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
public void dismissWithAction(OnDismissAction r, Runnable cancelAction,
|
||||
boolean afterKeyguardGone) {
|
||||
if (mShowing) {
|
||||
cancelPendingDismissAction();
|
||||
// If we're dozing, this needs to be delayed until after we wake up - unless we're
|
||||
// wake-and-unlocking, because there dozing will last until the end of the transition.
|
||||
if (mDozing && !isWakeAndUnlocking()) {
|
||||
mPendingDismissAction = new PendingDismissActionRequest(
|
||||
r, cancelAction, afterKeyguardGone);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!afterKeyguardGone) {
|
||||
mBouncer.showWithDismissAction(r, cancelAction);
|
||||
} else {
|
||||
@@ -189,6 +206,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
updateStates();
|
||||
}
|
||||
|
||||
private boolean isWakeAndUnlocking() {
|
||||
int mode = mFingerprintUnlockController.getMode();
|
||||
return mode == MODE_WAKE_AND_UNLOCK || mode == MODE_WAKE_AND_UNLOCK_PULSING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a {@param runnable} to be executed after Keyguard is gone.
|
||||
*/
|
||||
@@ -204,7 +226,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
if (mOccluded) {
|
||||
mStatusBar.hideKeyguard();
|
||||
mStatusBar.stopWaitingForKeyguardExit();
|
||||
mBouncer.hide(false /* destroyView */);
|
||||
hideBouncer(false /* destroyView */);
|
||||
} else {
|
||||
showBouncerOrKeyguard(hideBouncerWhenShowing);
|
||||
}
|
||||
@@ -254,6 +276,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
reset(dozing /* hideBouncerWhenShowing */);
|
||||
}
|
||||
updateStates();
|
||||
|
||||
if (!dozing) {
|
||||
launchPendingDismissAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +352,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
*/
|
||||
public void hide(long startTime, long fadeoutDuration) {
|
||||
mShowing = false;
|
||||
launchPendingDismissAction();
|
||||
|
||||
if (KeyguardUpdateMonitor.getInstance(mContext).needsSlowUnlockTransition()) {
|
||||
fadeoutDuration = KEYGUARD_DISMISS_DURATION_LOCKED;
|
||||
@@ -339,7 +366,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
public void run() {
|
||||
mStatusBarWindowManager.setKeyguardShowing(false);
|
||||
mStatusBarWindowManager.setKeyguardFadingAway(true);
|
||||
mBouncer.hide(true /* destroyView */);
|
||||
hideBouncer(true /* destroyView */);
|
||||
updateStates();
|
||||
mScrimController.animateKeyguardFadingOut(
|
||||
StatusBar.FADE_KEYGUARD_START_DELAY,
|
||||
@@ -365,7 +392,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
}
|
||||
mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
|
||||
mFingerprintUnlockController.startKeyguardFadingAway();
|
||||
mBouncer.hide(true /* destroyView */);
|
||||
hideBouncer(true /* destroyView */);
|
||||
if (wakeUnlockPulsing) {
|
||||
mStatusBarWindowManager.setKeyguardFadingAway(true);
|
||||
mStatusBar.fadeKeyguardWhilePulsing();
|
||||
@@ -408,11 +435,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
}
|
||||
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
mBouncer.hide(true /* destroyView */);
|
||||
hideBouncer(true /* destroyView */);
|
||||
}
|
||||
|
||||
public void onOverlayChanged() {
|
||||
mBouncer.hide(true /* destroyView */);
|
||||
hideBouncer(true /* destroyView */);
|
||||
mBouncer.prepare();
|
||||
}
|
||||
|
||||
@@ -652,4 +679,38 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
public ViewRootImpl getViewRootImpl() {
|
||||
return mStatusBar.getStatusBarView().getViewRootImpl();
|
||||
}
|
||||
|
||||
public void launchPendingDismissAction() {
|
||||
PendingDismissActionRequest request = mPendingDismissAction;
|
||||
mPendingDismissAction = null;
|
||||
if (request != null) {
|
||||
if (mShowing) {
|
||||
dismissWithAction(request.dismissAction, request.cancelAction,
|
||||
request.afterKeyguardGone);
|
||||
} else if (request.dismissAction != null) {
|
||||
request.dismissAction.onDismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelPendingDismissAction() {
|
||||
PendingDismissActionRequest request = mPendingDismissAction;
|
||||
mPendingDismissAction = null;
|
||||
if (request != null && request.cancelAction != null) {
|
||||
request.cancelAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
private static class PendingDismissActionRequest {
|
||||
final OnDismissAction dismissAction;
|
||||
final Runnable cancelAction;
|
||||
final boolean afterKeyguardGone;
|
||||
|
||||
PendingDismissActionRequest(OnDismissAction dismissAction, Runnable cancelAction,
|
||||
boolean afterKeyguardGone) {
|
||||
this.dismissAction = dismissAction;
|
||||
this.cancelAction = cancelAction;
|
||||
this.afterKeyguardGone = afterKeyguardGone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user