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

Commit 295748a6 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Trigger face auth on udfps-fingerdown, even on AOD" into tm-dev am:...

Merge "Trigger face auth on udfps-fingerdown, even on AOD" into tm-dev am: 603dfa75 am: a8c18fe7

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



Change-Id: I5ec1a8c03575f5019f8630e7a4f2977e0d3c108f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8cc65c1e a8c18fe7
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1536,6 +1536,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
@@ -2237,7 +2241,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() {
@@ -2487,7 +2491,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
+0 −9
Original line number Diff line number Diff line
@@ -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();

+0 −73
Original line number Diff line number Diff line
@@ -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 {