diff options
2 files changed, 30 insertions, 30 deletions
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 b46ed57fb866..aab5ff8d92e6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -537,27 +537,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mPendingShowBouncer = false; } - @Override - public void onStartedGoingToSleep(int why) { - resetMode(); - mFadedAwayAfterWakeAndUnlock = false; - mPendingAuthenticated = null; - } - - @Override - public void onFinishedGoingToSleep(int why) { - Trace.beginSection("BiometricUnlockController#onFinishedGoingToSleep"); - if (mPendingAuthenticated != null) { - PendingAuthenticated pendingAuthenticated = mPendingAuthenticated; - // Post this to make sure it's executed after the device is fully locked. - mHandler.post(() -> onBiometricAuthenticated(pendingAuthenticated.userId, - pendingAuthenticated.biometricSourceType, - pendingAuthenticated.isStrongBiometric)); - mPendingAuthenticated = null; - } - Trace.endSection(); - } - public boolean hasPendingAuthentication() { return mPendingAuthenticated != null && mUpdateMonitor @@ -752,13 +731,34 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp @VisibleForTesting final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() { - @Override - public void onFinishedWakingUp() { - if (mPendingShowBouncer) { - BiometricUnlockController.this.showBouncer(); - } - } - }; + @Override + public void onFinishedWakingUp() { + if (mPendingShowBouncer) { + BiometricUnlockController.this.showBouncer(); + } + } + + @Override + public void onStartedGoingToSleep() { + resetMode(); + mFadedAwayAfterWakeAndUnlock = false; + mPendingAuthenticated = null; + } + + @Override + public void onFinishedGoingToSleep() { + Trace.beginSection("BiometricUnlockController#onFinishedGoingToSleep"); + if (mPendingAuthenticated != null) { + PendingAuthenticated pendingAuthenticated = mPendingAuthenticated; + // Post this to make sure it's executed after the device is fully locked. + mHandler.post(() -> onBiometricAuthenticated(pendingAuthenticated.userId, + pendingAuthenticated.biometricSourceType, + pendingAuthenticated.isStrongBiometric)); + mPendingAuthenticated = null; + } + Trace.endSection(); + } + }; private final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() { 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 ed144fa99369..142c2c1ed017 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 @@ -408,7 +408,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Test public void onFinishedGoingToSleep_authenticatesWhenPending() { when(mUpdateMonitor.isGoingToSleep()).thenReturn(true); - mBiometricUnlockController.onFinishedGoingToSleep(-1); + mBiometricUnlockController.mWakefulnessObserver.onFinishedGoingToSleep(); verify(mHandler, never()).post(any()); ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); @@ -416,7 +416,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { // value of isUnlockingWithBiometricAllowed() mBiometricUnlockController.onBiometricAuthenticated(1 /* userId */, BiometricSourceType.FACE, true /* isStrongBiometric */); - mBiometricUnlockController.onFinishedGoingToSleep(-1); + mBiometricUnlockController.mWakefulnessObserver.onFinishedGoingToSleep(); verify(mHandler).post(captor.capture()); captor.getValue().run(); } |