From f59c777ff83c78ddb313c4f3ec09e151d6d7cd38 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: 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 Bug: 240637815 Change-Id: I5fcd53c4942a855d15dc1c11e22995761a69741c --- .../phone/BiometricUnlockController.java | 41 ++----------------- .../phone/BiometricsUnlockControllerTest.java | 23 +---------- 2 files changed, 5 insertions(+), 59 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 87d1d66462bd2..0b2d443598d27 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -52,14 +52,11 @@ import com.android.systemui.biometrics.AuthController; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; -import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shade.ShadeController; -import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.VibratorHelper; @@ -153,7 +150,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private final Handler mHandler; private final KeyguardBypassController mKeyguardBypassController; private PowerManager.WakeLock mWakeLock; - private final com.android.systemui.shade.ShadeController mShadeController; private final KeyguardUpdateMonitor mUpdateMonitor; private final DozeParameters mDozeParameters; private final KeyguardStateController mKeyguardStateController; @@ -167,7 +163,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; @@ -259,13 +254,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp ); } - private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; private final ScreenOffAnimationController mScreenOffAnimationController; @Inject public BiometricUnlockController(DozeScrimController dozeScrimController, KeyguardViewMediator keyguardViewMediator, ScrimController scrimController, - ShadeController shadeController, NotificationShadeWindowController notificationShadeWindowController, KeyguardStateController keyguardStateController, Handler handler, KeyguardUpdateMonitor keyguardUpdateMonitor, @@ -278,13 +271,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp ScreenLifecycle screenLifecycle, AuthController authController, StatusBarStateController statusBarStateController, - KeyguardUnlockAnimationController keyguardUnlockAnimationController, SessionTracker sessionTracker, LatencyTracker latencyTracker, ScreenOffAnimationController screenOffAnimationController, VibratorHelper vibrator) { mPowerManager = powerManager; - mShadeController = shadeController; mUpdateMonitor = keyguardUpdateMonitor; mDozeParameters = dozeParameters; mUpdateMonitor.registerCallback(this); @@ -306,7 +297,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mMetricsLogger = metricsLogger; mAuthController = authController; mStatusBarStateController = statusBarStateController; - mKeyguardUnlockAnimationController = keyguardUnlockAnimationController; mSessionTracker = sessionTracker; mScreenOffAnimationController = screenOffAnimationController; mVibratorHelper = vibrator; @@ -462,22 +452,13 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp break; case MODE_UNLOCK_COLLAPSING: Trace.beginSection("MODE_UNLOCK_COLLAPSING"); - if (!wasDeviceInteractive) { - mPendingShowBouncer = true; - } else { - mPendingShowBouncer = false; - mKeyguardViewController.notifyKeyguardAuthenticated( - false /* strongAuth */); - } + 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: @@ -515,15 +496,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 @@ -741,13 +713,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 cce2e8994a0c0..365e60868b42d 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 @@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; @@ -45,13 +44,11 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.biometrics.AuthController; import com.android.systemui.dump.DumpManager; -import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.VibratorHelper; @@ -90,8 +87,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Mock private BiometricUnlockController.BiometricModeListener mBiometricModeListener; @Mock - private ShadeController mShadeController; - @Mock private KeyguardStateController mKeyguardStateController; @Mock private Handler mHandler; @@ -112,8 +107,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Mock private StatusBarStateController mStatusBarStateController; @Mock - private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; - @Mock private SessionTracker mSessionTracker; @Mock private LatencyTracker mLatencyTracker; @@ -137,12 +130,12 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { when(mVibratorHelper.hasVibrator()).thenReturn(true); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, - mKeyguardViewMediator, mScrimController, mShadeController, + mKeyguardViewMediator, mScrimController, mNotificationShadeWindowController, mKeyguardStateController, mHandler, mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters, mMetricsLogger, mDumpManager, mPowerManager, mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle, - mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController, + mAuthController, mStatusBarStateController, mSessionTracker, mLatencyTracker, mScreenOffAnimationController, mVibratorHelper); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener); @@ -167,8 +160,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()) @@ -246,8 +237,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FACE, true /* isStrongBiometric */); - verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(), - anyBoolean(), anyFloat()); verify(mStatusBarKeyguardViewManager, never()).notifyKeyguardAuthenticated(anyBoolean()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_NONE); @@ -298,10 +287,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); @@ -332,8 +317,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { BiometricSourceType.FACE, true /* isStrongBiometric */); verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); - verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(), - anyBoolean(), anyFloat()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_NONE); } @@ -383,8 +366,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FACE, true /* isStrongBiometric */); - verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(), - anyBoolean(), anyFloat()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_ONLY_WAKE); }