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

Commit c58e111b authored by Austin Delgado's avatar Austin Delgado
Browse files

Pilfer pointers when alternate bouncer is showing

Pilfer pointers when alternate bouncer is showing to prevent touches
passing through when there is an occluding activity (e.g. camera)

Test: atest SystemUITests:com.android.systemui.biometrics
Bug: 274160958
Change-Id: I3fb497bd39ea2371dfc2e23f49c0dc28f0533e44
parent 25b58217
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -617,9 +617,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