From 222b7552f6799ab9ae4529f358a971df4fadd985 Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 9 Sep 2022 16:57:40 +0000 Subject: [PATCH] Don't collapse the shade when SHOW_BOUNCER It's not necessary to track showing a pending bouncer to show since showing the bouncer now wakes up the device. It's also not necessary to collapse the notification panel when showing the bouncer from an unlock attempt. This is also an old code path. Test: atest SystemUITests Test: atest BiometricsUnlockControllerTest Test: MODE_SHOW_BOUNCER from AoD and display off Test: On a device that supports rear fingerprint 1. enroll fp 2. restart device 3. attempt to authenticate from screen off 4. see bouncer appears (no regression) Test: 1. on device with udfps, expand the shade and tap on a clickable notification to see the udfps bouncer 2. Fail udfps 3 times so that the primary bouncer appears Observe: the primary bouncer appears instead of going back to LS Fixes: 240637815 Change-Id: I5fcd53c4942a855d15dc1c11e22995761a69741c Merged-In: I5fcd53c4942a855d15dc1c11e22995761a69741c --- .../phone/BiometricUnlockController.java | 48 +++++-------------- .../phone/BiometricsUnlockControllerTest.java | 6 --- 2 files changed, 11 insertions(+), 43 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 8bd7886c662ed..1bbacca60f811 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -177,7 +177,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private KeyguardViewMediator mKeyguardViewMediator; private ScrimController mScrimController; private PendingAuthenticated mPendingAuthenticated = null; - private boolean mPendingShowBouncer; private boolean mHasScreenTurnedOnSinceAuthenticating; private boolean mFadedAwayAfterWakeAndUnlock; private BiometricModeListener mBiometricModeListener; @@ -474,31 +473,22 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp break; case MODE_UNLOCK_COLLAPSING: Trace.beginSection("MODE_UNLOCK_COLLAPSING"); - if (!wasDeviceInteractive) { - mPendingShowBouncer = true; - } else { - // If the keyguard unlock controller is going to handle the unlock animation, it - // will fling the panel collapsed when it's ready. - if (!mKeyguardUnlockAnimationController.willHandleUnlockAnimation()) { - mShadeController.animateCollapsePanels( - CommandQueue.FLAG_EXCLUDE_NONE, - true /* force */, - false /* delayed */, - BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR); - } - mPendingShowBouncer = false; - mKeyguardViewController.notifyKeyguardAuthenticated( - false /* strongAuth */); + // If the keyguard unlock controller is going to handle the unlock animation, it + // will fling the panel collapsed when it's ready. + if (!mKeyguardUnlockAnimationController.willHandleUnlockAnimation()) { + mShadeController.animateCollapsePanels( + CommandQueue.FLAG_EXCLUDE_NONE, + true /* force */, + false /* delayed */, + BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR); } + mKeyguardViewController.notifyKeyguardAuthenticated( + false /* strongAuth */); Trace.endSection(); break; case MODE_SHOW_BOUNCER: Trace.beginSection("MODE_SHOW_BOUNCER"); - if (!wasDeviceInteractive) { - mPendingShowBouncer = true; - } else { - showBouncer(); - } + mKeyguardViewController.showBouncer(true); Trace.endSection(); break; case MODE_WAKE_AND_UNLOCK_FROM_DREAM: @@ -536,15 +526,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp } } - private void showBouncer() { - if (mMode == MODE_SHOW_BOUNCER) { - mKeyguardViewController.showBouncer(true); - } - mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */, - false /* delayed */, BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR); - mPendingShowBouncer = false; - } - public boolean hasPendingAuthentication() { return mPendingAuthenticated != null && mUpdateMonitor @@ -770,13 +751,6 @@ 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 onStartedGoingToSleep() { resetMode(); 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 a6808e01a0812..cd0cc33df1a98 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 @@ -167,8 +167,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FINGERPRINT, false /* isStrongBiometric */); verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); - verify(mShadeController).animateCollapsePanels(anyInt(), anyBoolean(), anyBoolean(), - anyFloat()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); assertThat(mBiometricUnlockController.getBiometricType()) @@ -298,10 +296,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FACE, true /* isStrongBiometric */); - // Wake up before showing the bouncer - verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); - mBiometricUnlockController.mWakefulnessObserver.onFinishedWakingUp(); - verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER);