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

Commit 1364df70 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-team Robot
Browse files

Show bouncer when unlocking and not interactive

We cannot dismiss the bouncer when the device cannot be unlocked,
otherwise we'll be stuck looking since gatekeeper is not unlocked.

Test: face auth from AOD2 encrypted
Test: face auth from lock screen encrypted
Test: face auth from AOD2
Test: atest BiometricsUnlockControllerTest
Fixes: 138093575
Change-Id: I5c5b89ee9fa1a10cedceaf1ab227e26910beed2a
(cherry picked from commit 81cdfa4a)
parent b653517b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -445,14 +445,13 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
        if (!mUpdateMonitor.isDeviceInteractive()) {
            if (!mStatusBarKeyguardViewManager.isShowing()) {
                return bypass ? MODE_WAKE_AND_UNLOCK : MODE_ONLY_WAKE;
            } else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
            } else if (!unlockingAllowed) {
                return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
            } else if (mDozeScrimController.isPulsing()) {
                // Let's not wake-up to lock screen when not bypassing, otherwise the notification
                // would move as the user tried to tap it.
                return bypass ? MODE_WAKE_AND_UNLOCK_PULSING : MODE_NONE;
            } else {
                if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) {
                    Log.wtf(TAG, "Face somehow arrived when the device was not interactive");
                }
                if (bypass) {
                    // Wake-up fading out nicely
                    return MODE_WAKE_AND_UNLOCK_PULSING;
@@ -530,7 +529,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
        mStatusBar.notifyBiometricAuthModeChanged();
    }

    private final WakefulnessLifecycle.Observer mWakefulnessObserver =
    @VisibleForTesting
    final WakefulnessLifecycle.Observer mWakefulnessObserver =
            new WakefulnessLifecycle.Observer() {
        @Override
        public void onFinishedWakingUp() {
+10 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {

    @Test
    public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() {
        reset(mUpdateMonitor);
        when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
        mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);

@@ -168,11 +169,18 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
                BiometricSourceType.FACE);

        // Wake up before showing the bouncer
        verify(mStatusBarKeyguardViewManager, never()).showBouncer(eq(false));
        mBiometricUnlockController.mWakefulnessObserver.onFinishedWakingUp();

        verify(mStatusBarKeyguardViewManager).showBouncer(eq(false));
        assertThat(mBiometricUnlockController.getMode())
                .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER);
    }

    @Test
    public void onBiometricAuthenticated_whenFace_noBypass_encrypted_doNothing() {
        reset(mUpdateMonitor);
        mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);

        when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(false);
@@ -181,6 +189,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {

        verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean());
        verify(mStatusBarKeyguardViewManager, never()).animateCollapsePanels(anyFloat());
        assertThat(mBiometricUnlockController.getMode())
                .isEqualTo(BiometricUnlockController.MODE_NONE);
    }

    @Test