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

Commit 9bddfad3 authored by Austin Delgado's avatar Austin Delgado Committed by Android (Google) Code Review
Browse files

Merge "Fix AOD flicker on certain devices" into main

parents 9a5bcfad 7efc1c3f
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())