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

Commit a723f506 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't update biometricListenState on SB stateChange" into sc-dev am: bc563d80

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14551938

Change-Id: Ie766c1100a66879f772f168d4592f9c429a5aada
parents b2ea76cc bc563d80
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -252,7 +252,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        @Override
        public void onStateChanged(int newState) {
            mStatusBarState = newState;
            updateBiometricListeningState();
        }

        @Override
+28 −0
Original line number Diff line number Diff line
@@ -942,6 +942,34 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
    }

    @Test
    public void testShouldNotUpdateBiometricListeningStateOnStatusBarStateChange() {
        // GIVEN state for face auth should run aside from StatusBarState
        when(mDevicePolicyManager.getKeyguardDisabledFeatures(null,
                KeyguardUpdateMonitor.getCurrentUser())).thenReturn(0);
        mStatusBarStateListener.onStateChanged(StatusBarState.SHADE_LOCKED);
        setKeyguardBouncerVisibility(false /* isVisible */);
        mKeyguardUpdateMonitor.dispatchStartedWakingUp();
        when(mKeyguardBypassController.canBypass()).thenReturn(true);
        mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);

        // WHEN status bar state reports a change to the keyguard that would normally indicate to
        // start running face auth
        mStatusBarStateListener.onStateChanged(StatusBarState.KEYGUARD);
        assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isEqualTo(true);

        // THEN face unlock is not running b/c status bar state changes don't cause biometric
        // listening state to update
        assertThat(mKeyguardUpdateMonitor.isFaceUnlockRunning(
                KeyguardUpdateMonitor.getCurrentUser())).isEqualTo(false);

        // WHEN biometric listening state is updated
        mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);

        // THEN face unlock is running
        assertThat(mKeyguardUpdateMonitor.isFaceDetectionRunning()).isEqualTo(true);
    }

    @Test
    public void testRequireUnlockForNfc_Broadcast() {
        KeyguardUpdateMonitorCallback callback = mock(KeyguardUpdateMonitorCallback.class);