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

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

Merge "Move setIgnoreDisplayTouches off main thread" into main

parents 54b080f5 242dc86e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing

    /**
     * Set whether the HAL should ignore display touches.
     * Only applies to sensors where the HAL is reponsible for handling touches.
     * Only applies to sensors where the HAL is responsible for handling touches.
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
+2 −12
Original line number Diff line number Diff line
@@ -792,7 +792,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi

    @Override
    public void setIgnoreDisplayTouches(long requestId, int sensorId, boolean ignoreTouches) {
        if (Flags.setIgnoreSpeedUp()) {
        mHandler.post(() -> {
            try {
                mFingerprintSensors.get(
                        sensorId).getLazySession().get().getSession().setIgnoreDisplayTouches(
@@ -801,18 +801,8 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
            } catch (Exception e) {
                Slog.w(getTag(), "setIgnore failed", e);
            }
        } else {
            mFingerprintSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(
                requestId, (client) -> {
                    if (!(client instanceof Udfps)) {
                        Slog.e(getTag(),
                                "setIgnoreDisplayTouches received during client: " + client);
                        return;
                    }
                    ((Udfps) client).setIgnoreDisplayTouches(ignoreTouches);
        });
    }
    }

    @Override
    public void onPowerPressed() {
+23 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import java.util.ArrayList;
@@ -110,6 +111,8 @@ public class FingerprintProviderTest {
    @Mock
    private Handler mBiometricCallbackHandler;
    @Mock
    private Handler mFingerprintHandler;
    @Mock
    private AuthSessionCoordinator mAuthSessionCoordinator;
    @Mock
    private BiometricScheduler<IFingerprint, ISession> mScheduler;
@@ -290,6 +293,26 @@ public class FingerprintProviderTest {
                anyBoolean());
    }

    @Test
    public void testSetIgnoreDisplayTouches() {
        waitForIdle();

        when(mBiometricHandlerProvider.getFingerprintHandler()).thenReturn(mFingerprintHandler);
        mFingerprintProvider = new FingerprintProvider(mContext,
                mBiometricStateCallback, mAuthenticationStateListeners, mSensorProps, TAG,
                mLockoutResetDispatcher, mGestureAvailabilityDispatcher, mBiometricContext,
                mDaemon, mBiometricHandlerProvider,
                false /* resetLockoutRequiresHardwareAuthToken */, true /* testHalEnabled */);
        waitForIdle();

        Mockito.reset(mFingerprintHandler);
        mFingerprintProvider.setIgnoreDisplayTouches(0L /* requestId */, 0 /* sensorId */,
                true /* ignoreTouches */);

        // Verify that the handler is being called for setIgnoreDisplayTouches
        verify(mFingerprintHandler).sendMessageDelayed(any(), anyLong());
    }

    private void waitForIdle() {
        mLooper.dispatchAll();
    }