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

Commit e3ed6706 authored by Joshua McCloskey's avatar Joshua McCloskey Committed by Automerger Merge Worker
Browse files

Cleaned up side fps logic am: 20987e7f

parents b03dabdf 20987e7f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3534,9 +3534,9 @@
         config_sidefpsSkipWaitForPowerVendorAcquireMessage -->
    <integer name="config_sidefpsSkipWaitForPowerAcquireMessage">6</integer>

    <!-- This vendor acquired message that will cause the sidefpsKgPowerPress window to be skipped.
         config_sidefpsSkipWaitForPowerOnFingerUp must be true and
         config_sidefpsSkipWaitForPowerAcquireMessage must be BIOMETRIC_ACQUIRED_VENDOR == 6. -->
    <!-- This vendor acquired message will cause the sidefpsKgPowerPress window to be skipped
         when config_sidefpsSkipWaitForPowerAcquireMessage == 6 (VENDOR) and the vendor acquire
         message equals this constant -->
    <integer name="config_sidefpsSkipWaitForPowerVendorAcquireMessage">2</integer>

    <!-- This config is used to force VoiceInteractionService to start on certain low ram devices.
+1 −2
Original line number Diff line number Diff line
@@ -265,8 +265,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession>
            final boolean acquireMessageMatch = acquiredInfo == mSkipWaitForPowerAcquireMessage;
            final boolean vendorMessageMatch = vendorCode == mSkipWaitForPowerVendorAcquireMessage;
            final boolean ignorePowerPress =
                    (acquireMessageMatch && !shouldLookForVendor) || (shouldLookForVendor
                            && acquireMessageMatch && vendorMessageMatch);
                    acquireMessageMatch && (!shouldLookForVendor || vendorMessageMatch);

            if (ignorePowerPress) {
                Slog.d(TAG, "(sideFPS) onFingerUp");
+47 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.hardware.biometrics.common.OperationContext;
import android.hardware.biometrics.fingerprint.ISession;
import android.hardware.biometrics.fingerprint.PointerContext;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.ISidefpsController;
import android.hardware.fingerprint.IUdfpsOverlayController;
@@ -446,6 +447,52 @@ public class FingerprintAuthenticationClientTest {
        verify(mCallback).onClientFinished(any(), eq(true));
    }

    @Test
    public void sideFingerprintSkipsWindowIfVendorMessageMatch() throws Exception {
        when(mSensorProps.isAnySidefpsType()).thenReturn(true);
        final int vendorAcquireMessage = 1234;

        mContext.getOrCreateTestableResources().addOverride(
                R.integer.config_sidefpsSkipWaitForPowerAcquireMessage,
                FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR);
        mContext.getOrCreateTestableResources().addOverride(
                R.integer.config_sidefpsSkipWaitForPowerVendorAcquireMessage,
                vendorAcquireMessage);

        final FingerprintAuthenticationClient client = createClient(1);
        client.start(mCallback);
        mLooper.dispatchAll();
        client.onAuthenticated(new Fingerprint("friendly", 4 /* fingerId */, 5 /* deviceId */),
                true /* authenticated */, new ArrayList<>());
        client.onAcquired(FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR, vendorAcquireMessage);
        mLooper.dispatchAll();

        verify(mCallback).onClientFinished(any(), eq(true));
    }

    @Test
    public void sideFingerprintDoesNotSkipWindowOnVendorErrorMismatch() throws Exception {
        when(mSensorProps.isAnySidefpsType()).thenReturn(true);
        final int vendorAcquireMessage = 1234;

        mContext.getOrCreateTestableResources().addOverride(
                R.integer.config_sidefpsSkipWaitForPowerAcquireMessage,
                FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR);
        mContext.getOrCreateTestableResources().addOverride(
                R.integer.config_sidefpsSkipWaitForPowerVendorAcquireMessage,
                vendorAcquireMessage);

        final FingerprintAuthenticationClient client = createClient(1);
        client.start(mCallback);
        mLooper.dispatchAll();
        client.onAuthenticated(new Fingerprint("friendly", 4 /* fingerId */, 5 /* deviceId */),
                true /* authenticated */, new ArrayList<>());
        client.onAcquired(FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR, 1);
        mLooper.dispatchAll();

        verify(mCallback, never()).onClientFinished(any(), anyBoolean());
    }

    @Test
    public void sideFingerprintSendsAuthIfFingerUp() throws Exception {
        when(mSensorProps.isAnySidefpsType()).thenReturn(true);