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

Commit b1f9479a authored by Austin Delgado's avatar Austin Delgado Committed by Android Build Coastguard Worker
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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7efc1c3faba98e7b94b5f6fc2523f3503262b2c1)
Merged-In: Ic6644ccafa4bb63b83930491ce18d14f2db6db22
Change-Id: Ic6644ccafa4bb63b83930491ce18d14f2db6db22
parent efa6de95
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())