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

Commit a055a671 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Dismiss bouncer properly on SHADE_LOCKED

Test: atest BiometricsUnlockControllerTest
Test: dismiss bouncer after hitting reply button
Test: hit back on bouncer on shade_locked
Test: tap on padlock on camera app, swipe up to retry
Bug: 134096479
Fixes: 137517676
Change-Id: I12e5bbd2c5ceac642a281fc16c5398e09e65ca9d
parent 60d84348
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -467,8 +467,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
        }
        if (mStatusBarKeyguardViewManager.isShowing()) {
            if (mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing() && unlockingAllowed) {
                return bypass && !mKeyguardBypassController.canPlaySubtleWindowAnimations()
                        ? MODE_UNLOCK_COLLAPSING : MODE_UNLOCK_FADING;
                if (bypass && mKeyguardBypassController.canPlaySubtleWindowAnimations()) {
                    return MODE_UNLOCK_FADING;
                } else {
                    return MODE_DISMISS_BOUNCER;
                }
            } else if (unlockingAllowed) {
                return bypass ? MODE_UNLOCK_FADING : MODE_NONE;
            } else {
+30 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.phone;

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;
@@ -191,6 +193,34 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
    }

    @Test
    public void onBiometricAuthenticated_whenBypassOnBouncer_dismissBouncer() {
        reset(mKeyguardBypassController);
        when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true);
        when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
        when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true);
        when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true);
        mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
                BiometricSourceType.FACE);

        verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
        assertThat(mBiometricUnlockController.getMode())
                .isEqualTo(BiometricUnlockController.MODE_DISMISS_BOUNCER);
    }

    @Test
    public void onBiometricAuthenticated_whenBypassOnBouncer_respectsCanPlaySubtleAnim() {
        when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true);
        when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
        when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true);
        mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
                BiometricSourceType.FACE);

        verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
        assertThat(mBiometricUnlockController.getMode())
                .isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING);
    }

    @Test
    public void onBiometricAuthenticated_whenFaceAndPulsing_dontDismissKeyguard() {
        reset(mUpdateMonitor);