Trigger face auth on udfps-fingerdown, even on AOD

Test: manual
Fixes: 209924058
Change-Id: Ie6fe439c6d3cd4ed07cbf84e1547d08e2368cd5a
This commit is contained in:
Beverly 2022-04-01 13:24:25 +00:00 committed by Beverly Tai
parent e4dcbf5af9
commit f024fc1a8e
3 changed files with 7 additions and 84 deletions

View File

@ -1524,6 +1524,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
@Override
public void onUdfpsPointerDown(int sensorId) {
Log.d(TAG, "onUdfpsPointerDown, sensorId: " + sensorId);
requestFaceAuth(true);
if (isFaceDetectionRunning()) {
mKeyguardBypassController.setUserHasDeviceEntryIntent(true);
}
}
@Override
@ -2221,7 +2225,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
public void requestFaceAuth(boolean userInitiatedRequest) {
if (DEBUG) Log.d(TAG, "requestFaceAuth() userInitiated=" + userInitiatedRequest);
mIsFaceAuthUserRequested |= userInitiatedRequest;
updateFaceListeningState(BIOMETRIC_ACTION_UPDATE);
updateFaceListeningState(BIOMETRIC_ACTION_START);
}
public boolean isFaceAuthUserRequested() {
@ -2472,7 +2476,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
final boolean shouldListen =
(mBouncerFullyShown || mAuthInterruptActive || mOccludingAppRequestingFace
|| awakeKeyguard || shouldListenForFaceAssistant)
|| awakeKeyguard || shouldListenForFaceAssistant
|| mAuthController.isUdfpsFingerDown())
&& !mSwitchingUser && !faceDisabledForUser && becauseCannotSkipBouncer
&& !mKeyguardGoingAway && biometricEnabledForUser && !mLockIconPressed
&& strongAuthAllowsScanning && mIsPrimaryUser

View File

@ -65,7 +65,6 @@ import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
@ -124,7 +123,6 @@ public class UdfpsController implements DozeReceiver {
@NonNull private final AccessibilityManager mAccessibilityManager;
@NonNull private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
@Nullable private final UdfpsHbmProvider mHbmProvider;
@NonNull private final KeyguardBypassController mKeyguardBypassController;
@NonNull private final ConfigurationController mConfigurationController;
@NonNull private final SystemClock mSystemClock;
@NonNull private final UnlockedScreenOffAnimationController
@ -533,7 +531,6 @@ public class UdfpsController implements DozeReceiver {
@NonNull UdfpsHapticsSimulator udfpsHapticsSimulator,
@NonNull Optional<UdfpsHbmProvider> hbmProvider,
@NonNull KeyguardStateController keyguardStateController,
@NonNull KeyguardBypassController keyguardBypassController,
@NonNull DisplayManager displayManager,
@Main Handler mainHandler,
@NonNull ConfigurationController configurationController,
@ -565,7 +562,6 @@ public class UdfpsController implements DozeReceiver {
mHbmProvider = hbmProvider.orElse(null);
screenLifecycle.addObserver(mScreenObserver);
mScreenOn = screenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_ON;
mKeyguardBypassController = keyguardBypassController;
mConfigurationController = configurationController;
mSystemClock = systemClock;
mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
@ -797,11 +793,6 @@ public class UdfpsController implements DozeReceiver {
return;
}
if (mOverlay.getAnimationViewController() instanceof UdfpsKeyguardViewController
&& !mStatusBarStateController.isDozing()) {
mKeyguardBypassController.setUserHasDeviceEntryIntent(true);
}
if (!mOnFingerDown) {
playStartHaptic();

View File

@ -67,7 +67,6 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
@ -150,8 +149,6 @@ public class UdfpsControllerTest extends SysuiTestCase {
@Mock
private KeyguardStateController mKeyguardStateController;
@Mock
private KeyguardBypassController mKeyguardBypassController;
@Mock
private DisplayManager mDisplayManager;
@Mock
private Handler mHandler;
@ -252,7 +249,6 @@ public class UdfpsControllerTest extends SysuiTestCase {
mUdfpsHapticsSimulator,
Optional.of(mHbmProvider),
mKeyguardStateController,
mKeyguardBypassController,
mDisplayManager,
mHandler,
mConfigurationController,
@ -309,75 +305,6 @@ public class UdfpsControllerTest extends SysuiTestCase {
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(anyBoolean());
}
@Test
public void onActionMove_dozing_setDeviceEntryIntent() throws RemoteException {
// GIVEN the current animation is UdfpsKeyguardViewController and device IS dozing
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true);
when(mUdfpsView.getAnimationViewController()).thenReturn(mUdfpsKeyguardViewController);
when(mStatusBarStateController.isDozing()).thenReturn(true);
// GIVEN that the overlay is showing
mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, TEST_UDFPS_SENSOR_ID,
BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback);
mFgExecutor.runAllReady();
// WHEN ACTION_DOWN is received
verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture());
MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0);
mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
moveEvent.recycle();
// THEN device entry intent is never to true b/c device was dozing on touch
verify(mKeyguardBypassController, never()).setUserHasDeviceEntryIntent(true);
}
@Test
public void onActionMove_onKeyguard_setDeviceEntryIntent() throws RemoteException {
// GIVEN the current animation is UdfpsKeyguardViewController and device isn't dozing
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true);
when(mUdfpsView.getAnimationViewController()).thenReturn(mUdfpsKeyguardViewController);
when(mStatusBarStateController.isDozing()).thenReturn(false);
// GIVEN that the overlay is showing
mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, TEST_UDFPS_SENSOR_ID,
BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback);
mFgExecutor.runAllReady();
// WHEN ACTION_DOWN is received
verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture());
MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0);
mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
moveEvent.recycle();
// THEN device entry intent is set to true
verify(mKeyguardBypassController).setUserHasDeviceEntryIntent(true);
}
@Test
public void onActionMove_onEnrollment_neverSetDeviceEntryIntent() throws RemoteException {
// GIVEN the current animation is UdfpsEnrollViewController
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true);
when(mUdfpsView.getAnimationViewController()).thenReturn(
(UdfpsAnimationViewController) mock(UdfpsEnrollViewController.class));
// GIVEN that the overlay is showing
mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, TEST_UDFPS_SENSOR_ID,
BiometricOverlayConstants.REASON_ENROLL_ENROLLING, mUdfpsOverlayControllerCallback);
mFgExecutor.runAllReady();
// WHEN ACTION_DOWN is received
verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture());
MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0);
mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
moveEvent.recycle();
// THEN device entry intent is never set
verify(mKeyguardBypassController, never()).setUserHasDeviceEntryIntent(anyBoolean());
}
@Test
public void onActionMoveTouch_whenCanDismissLockScreen_entersDevice()
throws RemoteException {