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

Commit 258534b4 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

11/n: Finish remainder of IFingerprint implementation

With the exception of invalidateAuthenticatorId, all IFingerprint
plumbing should be ready for testing.

Updates RemovalConsumer#onRemoved to allow nullable identifiers,
since enrollmentId=0 is now valid from the HAL.

Fixes: 170497736
Test: Enroll, auth, remove on existing devices
Change-Id: I070a5416a33e6aa926823a9babd3ae81238a3c08
parent a9d78c78
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.biometrics.sensors;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.BiometricsProtoEnums;
@@ -64,8 +65,8 @@ public abstract class RemovalClient<S extends BiometricAuthenticator.Identifier,
    }

    @Override
    public void onRemoved(BiometricAuthenticator.Identifier identifier, int remaining) {
        if (identifier.getBiometricId() != 0) {
    public void onRemoved(@Nullable BiometricAuthenticator.Identifier identifier, int remaining) {
        if (identifier != null) {
            mBiometricUtils.removeBiometricForUser(getContext(), getTargetUserId(),
                    identifier.getBiometricId());
        }
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.biometrics.sensors;

import android.annotation.Nullable;
import android.hardware.biometrics.BiometricAuthenticator;

/**
@@ -28,5 +29,5 @@ public interface RemovalConsumer {
     * @param remaining number of templates that still need to be removed before the operation in
     *                  the HAL is complete (e.g. when removing all templates).
     */
    void onRemoved(BiometricAuthenticator.Identifier identifier, int remaining);
    void onRemoved(@Nullable BiometricAuthenticator.Identifier identifier, int remaining);
}
+1 −2
Original line number Diff line number Diff line
@@ -219,8 +219,7 @@ class Face10 implements IHwBinder.DeathRecipient {
                        removalConsumer.onRemoved(face, remaining);
                    }
                } else {
                    final Face face = new Face("", 0 /* identifier */, deviceId);
                    removalConsumer.onRemoved(face, 0 /* remaining */);
                    removalConsumer.onRemoved(null, 0 /* remaining */);
                }

                Settings.Secure.putIntForUser(mContext.getContentResolver(),
+12 −0
Original line number Diff line number Diff line
@@ -78,4 +78,16 @@ class FingerprintDetectClient extends AcquisitionClient<ISession> {
            mCallback.onClientFinished(this, false /* success */);
        }
    }

    void onInteractionDetected() {
        vibrateSuccess();

        try {
            getListener().onDetected(getSensorId(), getTargetUserId(), mIsStrongBiometric);
            mCallback.onClientFinished(this, true /* success */);
        } catch (RemoteException e) {
            Slog.e(TAG, "Remote exception when sending onDetected", e);
            mCallback.onClientFinished(this, false /* success */);
        }
    }
}
+11 −1
Original line number Diff line number Diff line
@@ -25,16 +25,21 @@ import android.util.Slog;

import com.android.server.biometrics.sensors.ClientMonitor;

import java.util.Map;

class FingerprintGetAuthenticatorIdClient extends ClientMonitor<ISession> {

    private static final String TAG = "FingerprintGetAuthenticatorIdClient";

    private final Map<Integer, Long> mAuthenticatorIds;

    FingerprintGetAuthenticatorIdClient(@NonNull Context context,
            @NonNull LazyDaemon<ISession> lazyDaemon, int userId, @NonNull String owner,
            int sensorId) {
            int sensorId, Map<Integer, Long> authenticatorIds) {
        super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
                0 /* cookie */, sensorId, BiometricsProtoEnums.MODALITY_FINGERPRINT,
                BiometricsProtoEnums.ACTION_UNKNOWN, BiometricsProtoEnums.CLIENT_UNKNOWN);
        mAuthenticatorIds = authenticatorIds;
    }

    @Override
@@ -50,4 +55,9 @@ class FingerprintGetAuthenticatorIdClient extends ClientMonitor<ISession> {
            Slog.e(TAG, "Remote exception", e);
        }
    }

    void onAuthenticatorIdRetrieved(long authenticatorId) {
        mAuthenticatorIds.put(getTargetUserId(), authenticatorId);
        mCallback.onClientFinished(this, true /* success */);
    }
}
Loading