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

Commit 8bfc5786 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't navigate to lockscreen on FP failures when dreaming" into...

Merge "Don't navigate to lockscreen on FP failures when dreaming" into udc-qpr-dev am: 6ba2bfd4 am: a8f8a0a1

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



Change-Id: I232fe949ccd4ef5afce522e2f47cca833819b8aa
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4b03c1b8 a8f8a0a1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;

import static android.app.StatusBarManager.SESSION_KEYGUARD;

import static com.android.systemui.flags.Flags.FP_LISTEN_OCCLUDING_APPS;
import static com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION;
import static com.android.systemui.keyguard.WakefulnessLifecycle.UNKNOWN_LAST_WAKE_TIME;

@@ -696,8 +697,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
            mLatencyTracker.onActionCancel(action);
        }

        if (!mVibratorHelper.hasVibrator()
                && (!mUpdateMonitor.isDeviceInteractive() || mUpdateMonitor.isDreaming())) {
        final boolean screenOff = !mUpdateMonitor.isDeviceInteractive();
        if (!mVibratorHelper.hasVibrator() && (screenOff || (mUpdateMonitor.isDreaming()
                && !mFeatureFlags.isEnabled(FP_LISTEN_OCCLUDING_APPS)))) {
            mLogger.d("wakeup device on authentication failure (device doesn't have a vibrator)");
            startWakeAndUnlock(MODE_ONLY_WAKE);
        } else if (biometricSourceType == BiometricSourceType.FINGERPRINT
+42 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.phone;

import static com.android.systemui.flags.Flags.FP_LISTEN_OCCLUDING_APPS;
import static com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;

@@ -125,12 +126,15 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
    @Mock
    private ViewRootImpl mViewRootImpl;
    private final FakeSystemClock mSystemClock = new FakeSystemClock();
    private FakeFeatureFlags mFeatureFlags;
    private BiometricUnlockController mBiometricUnlockController;
    private final FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags();

    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        mFeatureFlags = new FakeFeatureFlags();
        mFeatureFlags.set(FP_LISTEN_OCCLUDING_APPS, false);
        mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
        TestableResources res = getContext().getOrCreateTestableResources();
        when(mKeyguardStateController.isShowing()).thenReturn(true);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
@@ -156,7 +160,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        mBiometricUnlockController.addListener(mBiometricUnlockEventsListener);
        when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
        when(mStatusBarKeyguardViewManager.getViewRootImpl()).thenReturn(mViewRootImpl);
        mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
    }

    @Test
@@ -428,7 +431,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {

    @Test
    public void onFPFailureNoHaptics_notInteractive_showLockScreen() {
        // GIVEN no vibrator and device is dreaming
        mFeatureFlags.set(FP_LISTEN_OCCLUDING_APPS, true);

        // GIVEN no vibrator and device is not interactive
        when(mVibratorHelper.hasVibrator()).thenReturn(false);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(false);
        when(mUpdateMonitor.isDreaming()).thenReturn(false);

        // WHEN FP fails
        mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT);

        // THEN wakeup the device
        verify(mPowerManager).wakeUp(anyLong(), anyInt(), anyString());
    }

    @Test
    public void onFPFailureNoHaptics_notInteractive_showLockScreen_doNotListenOccludingApps() {
        mFeatureFlags.set(FP_LISTEN_OCCLUDING_APPS, false);

        // GIVEN no vibrator and device is not interactive
        when(mVibratorHelper.hasVibrator()).thenReturn(false);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(false);
        when(mUpdateMonitor.isDreaming()).thenReturn(false);
@@ -442,6 +463,24 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {

    @Test
    public void onFPFailureNoHaptics_dreaming_showLockScreen() {
        mFeatureFlags.set(FP_LISTEN_OCCLUDING_APPS, true);

        // GIVEN no vibrator and device is dreaming
        when(mVibratorHelper.hasVibrator()).thenReturn(false);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
        when(mUpdateMonitor.isDreaming()).thenReturn(true);

        // WHEN FP fails
        mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT);

        // THEN never wakeup the device
        verify(mPowerManager, never()).wakeUp(anyLong(), anyInt(), anyString());
    }

    @Test
    public void onFPFailureNoHaptics_dreaming_showLockScreen_doNotListeOccludingApps() {
        mFeatureFlags.set(FP_LISTEN_OCCLUDING_APPS, false);

        // GIVEN no vibrator and device is dreaming
        when(mVibratorHelper.hasVibrator()).thenReturn(false);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);