Merge "Don't navigate to lockscreen on FP failures when dreaming" into udc-qpr-dev

This commit is contained in:
Treehugger Robot
2023-07-27 16:30:56 +00:00
committed by Android (Google) Code Review
2 changed files with 46 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
import static android.app.StatusBarManager.SESSION_KEYGUARD; 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.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION;
import static com.android.systemui.keyguard.WakefulnessLifecycle.UNKNOWN_LAST_WAKE_TIME; import static com.android.systemui.keyguard.WakefulnessLifecycle.UNKNOWN_LAST_WAKE_TIME;
@@ -696,8 +697,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mLatencyTracker.onActionCancel(action); mLatencyTracker.onActionCancel(action);
} }
if (!mVibratorHelper.hasVibrator() final boolean screenOff = !mUpdateMonitor.isDeviceInteractive();
&& (!mUpdateMonitor.isDeviceInteractive() || mUpdateMonitor.isDreaming())) { 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)"); mLogger.d("wakeup device on authentication failure (device doesn't have a vibrator)");
startWakeAndUnlock(MODE_ONLY_WAKE); startWakeAndUnlock(MODE_ONLY_WAKE);
} else if (biometricSourceType == BiometricSourceType.FINGERPRINT } else if (biometricSourceType == BiometricSourceType.FINGERPRINT

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.phone; 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.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
@@ -125,12 +126,15 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Mock @Mock
private ViewRootImpl mViewRootImpl; private ViewRootImpl mViewRootImpl;
private final FakeSystemClock mSystemClock = new FakeSystemClock(); private final FakeSystemClock mSystemClock = new FakeSystemClock();
private FakeFeatureFlags mFeatureFlags;
private BiometricUnlockController mBiometricUnlockController; private BiometricUnlockController mBiometricUnlockController;
private final FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags();
@Before @Before
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); 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(); TestableResources res = getContext().getOrCreateTestableResources();
when(mKeyguardStateController.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
@@ -156,7 +160,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.addListener(mBiometricUnlockEventsListener); mBiometricUnlockController.addListener(mBiometricUnlockEventsListener);
when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker); when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
when(mStatusBarKeyguardViewManager.getViewRootImpl()).thenReturn(mViewRootImpl); when(mStatusBarKeyguardViewManager.getViewRootImpl()).thenReturn(mViewRootImpl);
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
} }
@Test @Test
@@ -428,7 +431,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Test @Test
public void onFPFailureNoHaptics_notInteractive_showLockScreen() { 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(mVibratorHelper.hasVibrator()).thenReturn(false);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(false); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(false);
when(mUpdateMonitor.isDreaming()).thenReturn(false); when(mUpdateMonitor.isDreaming()).thenReturn(false);
@@ -442,6 +463,24 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Test @Test
public void onFPFailureNoHaptics_dreaming_showLockScreen() { 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 // GIVEN no vibrator and device is dreaming
when(mVibratorHelper.hasVibrator()).thenReturn(false); when(mVibratorHelper.hasVibrator()).thenReturn(false);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);