Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7afd3eeb authored by Matt Pietal's avatar Matt Pietal
Browse files

MODE_SHOW_BOUNCER - Make sure bouncer shows

On AOD, multiple failed attempts to unlock via fingerprint should
display the bouncer. Add a condition to the panel expansion that will
prevent the bouncer from showing and then immediately hiding.

Separately, reset() the BiometricUnlockController state after the
bouncer has been dismissed. This fixes an issue when the user swiped
back after the bouncer prompts.

Fixes: 259361580
Test: atest StatusBarKeyguardViewManagerTest
Change-Id: Ibeeea77249a0d56a8cd166088d0d54767cb4abf1
parent 858e21b5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -762,6 +762,15 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        return mHasScreenTurnedOnSinceAuthenticating;
    }

    @Override
    public void onKeyguardBouncerStateChanged(boolean bouncerIsOrWillBeShowing) {
        // When the bouncer is dismissed, treat this as a reset of the unlock mode. The user
        // may have gone back instead of successfully unlocking
        if (!bouncerIsOrWillBeShowing) {
            resetMode();
        }
    }

    @Override
    public void dump(PrintWriter pw, String[] args) {
        pw.println(" BiometricUnlockController:");
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.WindowInsets.Type.navigationBars;

import static com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_SHOW_BOUNCER;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_COLLAPSING;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
@@ -478,6 +479,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        } else if (mKeyguardStateController.isShowing()  && !hideBouncerOverDream) {
            if (!isWakeAndUnlocking()
                    && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER)
                    && !(mBiometricUnlockController.getMode() == MODE_SHOW_BOUNCER)
                    && !isUnlockCollapsing()) {
                if (mPrimaryBouncer != null) {
                    mPrimaryBouncer.setExpansion(fraction);
+17 −0
Original line number Diff line number Diff line
@@ -306,6 +306,23 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
        verify(mPrimaryBouncer, never()).setExpansion(anyFloat());
    }

    @Test
    public void onPanelExpansionChanged_neverTranslatesBouncerWhenShowBouncer() {
        // Since KeyguardBouncer.EXPANSION_VISIBLE = 0 panel expansion, if the unlock is dismissing
        // the bouncer, there may be an onPanelExpansionChanged(0) call to collapse the panel
        // which would mistakenly cause the bouncer to show briefly before its visibility
        // is set to hide. Therefore, we don't want to propagate panelExpansionChanged to the
        // bouncer if the bouncer is dismissing as a result of a biometric unlock.
        when(mBiometricUnlockController.getMode())
                .thenReturn(BiometricUnlockController.MODE_SHOW_BOUNCER);
        mStatusBarKeyguardViewManager.onPanelExpansionChanged(
                expansionEvent(
                        /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE,
                        /* expanded= */ true,
                        /* tracking= */ false));
        verify(mPrimaryBouncer, never()).setExpansion(anyFloat());
    }

    @Test
    public void onPanelExpansionChanged_neverTranslatesBouncerWhenShadeLocked() {
        when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE_LOCKED);