Enabling auth to succeed whenever the bouncer is showing

Previously we could get stuck in a state where the user
had to enter their pin.

Fixes: 135545123
Test: drag down with face expiring, then click on notifications. Observe working face
Change-Id: Ie9644dc8ff9a6a18067634478f96bb51675da80b
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
index 56b64df..4be4d90 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
@@ -33,20 +33,23 @@
     private val unlockMethodCache: UnlockMethodCache
     private val statusBarStateController: StatusBarStateController
 
-    lateinit var unlockController: BiometricUnlockController
-    var isPulseExpanding = false
-
-            /**
-             * If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
-             */
-    var bypassEnabled: Boolean = false
-        get() = field && unlockMethodCache.isUnlockingWithFacePossible
-        private set
     /**
      * The pending unlock type which is set if the bypass was blocked when it happened.
      */
     private var pendingUnlockType: BiometricSourceType? = null
 
+    lateinit var unlockController: BiometricUnlockController
+    var isPulseExpanding = false
+
+    /**
+     * If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
+     */
+    var bypassEnabled: Boolean = false
+        get() = field && unlockMethodCache.isUnlockingWithFacePossible
+        private set
+
+    var bouncerShowing: Boolean = false
+
     @Inject
     constructor(context: Context, tunerService: TunerService,
                 statusBarStateController: StatusBarStateController) {
@@ -85,6 +88,11 @@
      */
     fun onBiometricAuthenticated(biometricSourceType: BiometricSourceType): Boolean {
         if (bypassEnabled) {
+            if (bouncerShowing) {
+                // Whenever the bouncer is showing, we want to unlock. Otherwise we can get stuck
+                // in the shade locked where the bouncer wouldn't unlock
+                return true
+            }
             if (statusBarStateController.state != StatusBarState.KEYGUARD) {
                 // We're bypassing but not actually on the lockscreen, the user should decide when
                 // to unlock
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 0902484..2d4c1aa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -3571,6 +3571,7 @@
      */
     public void setBouncerShowing(boolean bouncerShowing) {
         mBouncerShowing = bouncerShowing;
+        mKeyguardBypassController.setBouncerShowing(bouncerShowing);
         if (mStatusBarView != null) mStatusBarView.setBouncerShowing(bouncerShowing);
         updateHideIconsForBouncer(true /* animate */);
         mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */);