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

Commit 19ccb4a5 authored by Joshua McCloskey's avatar Joshua McCloskey Committed by Joshua Mccloskey
Browse files

Don't send cancel after client finished

Test: atest FaceAuthenticationClientTest
Fixes: 283799745
Change-Id: I2ad06c55e43417c2571b015fc60a1138a8194bc1
(cherry picked from commit 7cdb05ab)
parent f346da37
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -266,8 +266,12 @@ public abstract class AuthenticationClient<T, O extends AuthenticateOptions>
            }
        } else {
            if (isBackgroundAuth) {
                Slog.e(TAG, "cancelling due to background auth");
                cancel();
                Slog.e(TAG, "Sending cancel to client(Due to background auth)");
                if (mTaskStackListener != null) {
                    mActivityTaskManager.unregisterTaskStackListener(mTaskStackListener);
                }
                sendCancelOnly(getListener());
                mCallback.onClientFinished(this, false);
            } else {
                // Allow system-defined limit of number of attempts before giving up
                if (mShouldUseLockoutTracker) {
+5 −1
Original line number Diff line number Diff line
@@ -16,8 +16,10 @@

package com.android.server.biometrics.sensors.face.aidl;

import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_ERROR_CANCELED;
import static android.hardware.biometrics.BiometricFaceConstants.FACE_ERROR_LOCKOUT;
import static android.hardware.biometrics.BiometricFaceConstants.FACE_ERROR_LOCKOUT_PERMANENT;

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.ArgumentMatchers.any;
@@ -205,7 +207,9 @@ public class FaceAuthenticationClientTest {
        client.onAuthenticated(new Face("friendly", 1 /* faceId */, 2 /* deviceId */),
                true /* authenticated */, new ArrayList<>());

        verify(mCancellationSignal).cancel();
        verify(mCancellationSignal, never()).cancel();
        verify(mClientMonitorCallbackConverter)
                .onError(anyInt(), anyInt(), eq(BIOMETRIC_ERROR_CANCELED), anyInt());
    }

    private FaceAuthenticationClient createClient() throws RemoteException {
+5 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.biometrics.sensors.fingerprint.aidl;

import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_ERROR_CANCELED;

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -399,7 +401,9 @@ public class FingerprintAuthenticationClientTest {

        mLooper.moveTimeForward(10);
        mLooper.dispatchAll();
        verify(mCancellationSignal).cancel();
        verify(mCancellationSignal, never()).cancel();
        verify(mClientMonitorCallbackConverter)
                .onError(anyInt(), anyInt(), eq(BIOMETRIC_ERROR_CANCELED), anyInt());
    }

    private FingerprintAuthenticationClient createClient() throws RemoteException {