From a5f90855533399b942c6eddb02eae5b94f42949a Mon Sep 17 00:00:00 2001 From: Beverly Date: Thu, 31 Mar 2022 14:13:41 +0000 Subject: [PATCH] WAKE_AND_UNLOCK when FP is auth'd while animating screen off Device was previously running MODE_ONLY_WAKE, so the user would instead see an unlocked lock screen when authenticating while the screen off animation was running. We also need to make sure the pendingLock (from goingToSleep) is reset to false, because one we start waking up from the biometric unlock, onStartedWakingUp is called and will attempt to handle any pending locks. Therefore, onKeyguardDone, let's remove the pending lock so that user doesn't get put back on the locked lock screen right after authenticating while the device was going to sleep. Test: manual Test: atest SystemUITests Fixes: 219478467 Change-Id: Ie52822bfeb9323fc2df942331da42f9654fadd96 --- .../systemui/keyguard/KeyguardViewMediator.java | 14 ++++++++++---- .../statusbar/phone/BiometricUnlockController.java | 8 ++++++-- .../phone/BiometricsUnlockControllerTest.java | 4 +++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 5f4b372d734b9..47763170d1ea4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1219,7 +1219,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, doKeyguardLaterLocked(timeout); mLockLater = true; } else if (!mLockPatternUtils.isLockScreenDisabled(currentUser)) { - mPendingLock = true; + setPendingLock(true); } if (mPendingLock) { @@ -1263,7 +1263,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, mContext.getSystemService(PowerManager.class).wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_CAMERA_LAUNCH, "com.android.systemui:CAMERA_GESTURE_PREVENT_LOCK"); - mPendingLock = false; + setPendingLock(false); mPendingReset = false; } @@ -1333,7 +1333,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, } doKeyguardLocked(null); - mPendingLock = false; + setPendingLock(false); } } @@ -2134,6 +2134,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, Log.i(TAG, "Device is going to sleep, aborting keyguardDone"); return; } + setPendingLock(false); // user may have authenticated during the screen off animation if (mExitSecureCallback != null) { try { mExitSecureCallback.onKeyguardExitResult(true /* authenciated */); @@ -2264,7 +2265,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, mHiding = false; mKeyguardExitAnimationRunner = null; mWakeAndUnlocking = false; - mPendingLock = false; + setPendingLock(false); setShowingLocked(true); mKeyguardViewControllerLazy.get().show(options); resetKeyguardDonePendingLocked(); @@ -3040,6 +3041,11 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, } } + private void setPendingLock(boolean hasPendingLock) { + mPendingLock = hasPendingLock; + Trace.traceCounter(Trace.TRACE_TAG_APP, "pendingLock", mPendingLock ? 1 : 0); + } + public void addStateMonitorCallback(IKeyguardStateCallback callback) { synchronized (this) { mKeyguardStateCallbacks.add(callback); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index 159d33b5a143b..f95093ef8ba40 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -265,6 +265,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp } private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; + private final ScreenOffAnimationController mScreenOffAnimationController; @Inject public BiometricUnlockController(DozeScrimController dozeScrimController, @@ -284,7 +285,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp StatusBarStateController statusBarStateController, KeyguardUnlockAnimationController keyguardUnlockAnimationController, SessionTracker sessionTracker, - LatencyTracker latencyTracker) { + LatencyTracker latencyTracker, + ScreenOffAnimationController screenOffAnimationController) { mPowerManager = powerManager; mShadeController = shadeController; mUpdateMonitor = keyguardUpdateMonitor; @@ -310,6 +312,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mStatusBarStateController = statusBarStateController; mKeyguardUnlockAnimationController = keyguardUnlockAnimationController; mSessionTracker = sessionTracker; + mScreenOffAnimationController = screenOffAnimationController; dumpManager.registerDumpable(getClass().getName(), this); } @@ -554,7 +557,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp boolean deviceDreaming = mUpdateMonitor.isDreaming(); if (!mUpdateMonitor.isDeviceInteractive()) { - if (!mKeyguardViewController.isShowing()) { + if (!mKeyguardViewController.isShowing() + && !mScreenOffAnimationController.isKeyguardShowDelayed()) { return MODE_ONLY_WAKE; } else if (mDozeScrimController.isPulsing() && unlockingAllowed) { return MODE_WAKE_AND_UNLOCK_PULSING; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index fb8c339e73c87..d6a2f0f22e5a9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -113,6 +113,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { private SessionTracker mSessionTracker; @Mock private LatencyTracker mLatencyTracker; + @Mock + private ScreenOffAnimationController mScreenOffAnimationController; private BiometricUnlockController mBiometricUnlockController; @Before @@ -134,7 +136,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mMetricsLogger, mDumpManager, mPowerManager, mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle, mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController, - mSessionTracker, mLatencyTracker); + mSessionTracker, mLatencyTracker, mScreenOffAnimationController); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener); }