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

Commit 49cc0622 authored by Austin Delgado's avatar Austin Delgado Committed by Automerger Merge Worker
Browse files

Merge "Pilfer pointers when alternate bouncer is showing" into udc-dev am:...

Merge "Pilfer pointers when alternate bouncer is showing" into udc-dev am: a03af9df am: 03c4b26a

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



Change-Id: Iff8057701242c3fb798980df5716dcf648b486a5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3c1b2a90 03c4b26a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -618,9 +618,9 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        }
        logBiometricTouch(processedTouch.getEvent(), data);

        // Always pilfer pointers that are within sensor area
        if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)) {
            Log.d("Austin", "pilferTouch invalid overlap");
        // Always pilfer pointers that are within sensor area or when alternate bouncer is showing
        if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)
                || mAlternateBouncerInteractor.isVisibleState()) {
            mInputManager.pilferPointers(
                    mOverlay.getOverlayView().getViewRootImpl().getInputToken());
        }
+40 −0
Original line number Diff line number Diff line
@@ -1343,6 +1343,46 @@ public class UdfpsControllerTest extends SysuiTestCase {
        verify(mInputManager, times(0)).pilferPointers(any());
    }

    @Test
    public void onTouch_withNewTouchDetection_pilferPointerWhenAltBouncerShowing()
            throws RemoteException {
        final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L,
                0L);
        final TouchProcessorResult processorResultUnchanged =
                new TouchProcessorResult.ProcessedTouch(InteractionEvent.UNCHANGED,
                        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 not accept the ACTION_DOWN event
        when(mUdfpsView.isDisplayConfigured()).thenReturn(false);
        when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(false);

        // 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());

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

        // THEN the touch is pilfered
        verify(mInputManager, times(1)).pilferPointers(any());
    }

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