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

Commit ccfdf94b authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Always allow UDFPS touches if alt bouncer is visible

QS can be mid-expansion but validly require UDFPS auth when
notifications are not allowed to be shown on the lockscreen.
When QS is in mid-expansion, we request/show the AlternateBouncer
so the user has an opportunity to use UDFPS to see their notifications.

Test: atest UdfpsControllerTest
Test: manual (don't show notifications on LS,
can still use UDFPS when requested to auth
when pulling down the shade on LS)
Fixes: 301037136

Change-Id: I5c91c4df394f8c6788077dd1ba60fe3123993d54
parent 83f9cf96
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -562,7 +562,9 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                    + mOverlay.getRequestId());
            return false;
        }
        if (mLockscreenShadeTransitionController.getQSDragProgress() != 0f

        if ((mLockscreenShadeTransitionController.getQSDragProgress() != 0f
                && !mAlternateBouncerInteractor.isVisibleState())
                || mPrimaryBouncerInteractor.isInTransit()) {
            return false;
        }
+47 −0
Original line number Diff line number Diff line
@@ -1597,6 +1597,53 @@ public class UdfpsControllerTest extends SysuiTestCase {
                anyBoolean());
    }


    @Test
    public void onTouch_withNewTouchDetection_qsDrag_processesTouchWhenAlternateBouncerVisible()
            throws RemoteException {
        final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L,
                0L);
        final TouchProcessorResult processorResultMove =
                new TouchProcessorResult.ProcessedTouch(InteractionEvent.DOWN,
                        1 /* pointerId */, touchData);

        // Enable new touch detection.
        when(mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true);

        // Configure UdfpsController to use FingerprintManager as opposed to AlternateTouchProvider.
        initUdfpsController(mOpticalProps, false /* hasAlternateTouchProvider */);

        // Configure UdfpsView to accept the ACTION_MOVE event
        when(mUdfpsView.isDisplayConfigured()).thenReturn(false);
        when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true);

        // GIVEN that the alternate bouncer is showing and a11y touch exploration NOT enabled
        when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false);
        when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true);
        mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId,
                BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback);
        mFgExecutor.runAllReady();

        verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture());

        // GIVEN swipe down for QS
        when(mPrimaryBouncerInteractor.isInTransit()).thenReturn(false);
        when(mLockscreenShadeTransitionController.getQSDragProgress()).thenReturn(1f);

        // WHEN ACTION_MOVE is received and touch is within sensor
        when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn(
                processorResultMove);
        MotionEvent moveEvent = MotionEvent.obtain(0, 0, ACTION_MOVE, 0, 0, 0);
        mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
        mBiometricExecutor.runAllReady();
        moveEvent.recycle();

        // THEN the touch is still processed
        verify(mFingerprintManager).onPointerDown(anyLong(), anyInt(), anyInt(),
                anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyLong(), anyLong(),
                anyBoolean());
    }

    @Test
    public void onAodInterrupt_onAcquiredGood_fingerNoLongerDown() throws RemoteException {
        // GIVEN UDFPS overlay is showing