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

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

Merge "Fix duplicate onFingerDown calls in UdfpsController" into udc-qpr-dev am: a5abab62

parents 39e8cec9 a5abab62
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -586,6 +586,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                if (shouldTryToDismissKeyguard()) {
                    tryDismissingKeyguard();
                }
                if (!mOnFingerDown) {
                    onFingerDown(requestId,
                            data.getPointerId(),
                            data.getX(),
@@ -596,6 +597,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                            data.getTime(),
                            data.getGestureStart(),
                            mStatusBarStateController.isDozing());
                }

                // Pilfer if valid overlap, don't allow following events to reach keyguard
                shouldPilfer = true;
+39 −0
Original line number Diff line number Diff line
@@ -1616,4 +1616,43 @@ public class UdfpsControllerTest extends SysuiTestCase {
        // THEN vibrate is used
        verify(mVibrator).performHapticFeedback(any(), eq(UdfpsController.LONG_PRESS));
    }

    @Test
    public void aodInterrupt_withNewTouchDetection() throws RemoteException {
        mUdfpsController.cancelAodSendFingerUpAction();
        final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L,
                0L);
        final TouchProcessorResult processorResultDown =
                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 */);

        // GIVEN that the overlay is showing and screen is on and fp is running
        mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, 0,
                BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback);
        mScreenObserver.onScreenTurnedOn();
        mFgExecutor.runAllReady();

        // WHEN fingerprint is requested because of AOD interrupt
        mUdfpsController.onAodInterrupt(0, 0, 2f, 3f);

        // Check case where touch driver sends touch to UdfpsView as well
        verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture());
        when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true);
        when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn(
                processorResultDown);
        MotionEvent downEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0);
        mTouchListenerCaptor.getValue().onTouch(mUdfpsView, downEvent);

        mBiometricExecutor.runAllReady();

        // THEN only one onPointerDown is sent
        verify(mFingerprintManager).onPointerDown(anyLong(), anyInt(), anyInt(), anyFloat(),
                anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyLong(), anyLong(), anyBoolean());
    }
}