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

Commit 7efc1c3f authored by Austin Delgado's avatar Austin Delgado
Browse files

Fix AOD flicker on certain devices

On some devices, both AOD doze triggers and the normal Udfps overlay touch get reported. This causes duplicate down events that can cause flickering. Add a check if the aodInterrupt is still active before registering a new down event.

Bug: 345411027
Test: atest UdfpsControllerTest
Flag: EXEMPT bugfix
Change-Id: Ic6644ccafa4bb63b83930491ce18d14f2db6db22
parent db3e4d9d
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -1283,6 +1283,41 @@ public class UdfpsControllerTest extends SysuiTestCase {
                anyBoolean());
    }

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

        mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId,
                BiometricRequestConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback);
        mFgExecutor.runAllReady();

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

        // WHEN fingerprint is requested because of AOD interrupt
        // GIVEN there's been an AoD interrupt
        when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true);
        mScreenObserver.onScreenTurnedOn();
        mUdfpsController.onAodInterrupt(0, 0, 0, 0);
        mFgExecutor.runAllReady();

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

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

    @Test
    public void onTouch_pilferPointerWhenAltBouncerShowing()
            throws RemoteException {
+6 −1
Original line number Diff line number Diff line
@@ -558,7 +558,12 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                Log.w(TAG, "onTouch down received without a preceding up");
            }
            mActivePointerId = MotionEvent.INVALID_POINTER_ID;

            // It's possible on some devices to get duplicate touches from both doze and the
            // normal touch listener. Don't reset the down in this case to avoid duplicate downs
            if (!mIsAodInterruptActive) {
                mOnFingerDown = false;
            }
        } else if (!DeviceEntryUdfpsRefactor.isEnabled()) {
            if ((mLockscreenShadeTransitionController.getQSDragProgress() != 0f
                    && !mAlternateBouncerInteractor.isVisibleState())