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

Commit cfbda1c9 authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Minor face/fingerprint mismatch fixes

Bug: none
Test: atest com.android.server.biometrics
Change-Id: I5646157cdc95457ceb14429ea0c1d32df520b17d
parent 961f7375
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {

    private void createNewSessionWithoutHandler(@NonNull IFace daemon, int sensorId,
            int userId) throws RemoteException {
        // Note that per IFingerprint createSession contract, this method will block until all
        // Note that per IFace createSession contract, this method will block until all
        // existing operations are canceled/finished. However, also note that this is fine, since
        // this method "withoutHandler" means it should only ever be invoked from the worker thread,
        // so callers will never be blocked.
+6 −13
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ import com.android.server.biometrics.sensors.face.FaceUtils;
import com.android.server.biometrics.sensors.face.LockoutHalImpl;
import com.android.server.biometrics.sensors.face.ServiceProvider;
import com.android.server.biometrics.sensors.face.UsageStats;
import com.android.server.biometrics.sensors.fingerprint.FingerprintUtils;

import org.json.JSONArray;
import org.json.JSONException;
@@ -259,8 +258,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {

                if (!removed.isEmpty()) {
                    // Convert to old fingerprint-like behavior, where remove() receives
                    // one removal
                    // at a time. This way, remove can share some more common code.
                    // one removal at a time. This way, remove can share some more common code.
                    for (int i = 0; i < removed.size(); i++) {
                        final int id = removed.get(i);
                        final Face face = new Face("", id, deviceId);
@@ -290,21 +288,16 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
                final EnumerateConsumer enumerateConsumer = (EnumerateConsumer) client;

                if (!faceIds.isEmpty()) {
                    // Convert to old fingerprint-like behavior, where enumerate()
                    // receives one
                    // template at a time. This way, enumerate can share some more common
                    // code.
                    // Convert to old fingerprint-like behavior, where enumerate() receives one
                    // template at a time. This way, enumerate can share some more common code.
                    for (int i = 0; i < faceIds.size(); i++) {
                        final Face face = new Face("", faceIds.get(i), deviceId);
                        enumerateConsumer.onEnumerationResult(face, faceIds.size() - i - 1);
                    }
                } else {
                    // For face, the HIDL contract is to receive an empty list when there
                    // are no
                    // templates enrolled. Send a null identifier since we don't consume
                    // them
                    // anywhere, and send remaining == 0 so this code can be shared with
                    // Fingerprint@2.1
                    // For face, the HIDL contract is to receive an empty list when there are no
                    // templates enrolled. Send a null identifier since we don't consume them
                    // anywhere, and send remaining == 0 so this code can be shared with Face@1.1
                    enumerateConsumer.onEnumerationResult(null /* identifier */, 0);
                }
            });
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.hardware.biometrics.BiometricFaceConstants;
import android.hardware.biometrics.BiometricFingerprintConstants;
import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.common.ICancellationSignal;
@@ -89,7 +88,8 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
                    HardwareAuthTokenUtils.toHardwareAuthToken(mHardwareAuthToken));
        } catch (RemoteException e) {
            Slog.e(TAG, "Remote exception when requesting enroll", e);
            onError(BiometricFaceConstants.FACE_ERROR_UNABLE_TO_PROCESS, 0 /* vendorCode */);
            onError(BiometricFingerprintConstants.FINGERPRINT_ERROR_UNABLE_TO_PROCESS,
                    0 /* vendorCode */);
            mCallback.onClientFinished(this, false /* success */);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public class FingerprintEnrollClient extends EnrollClient<IBiometricsFingerprint
        final int enrolled = mBiometricUtils.getBiometricsForUser(getContext(), getTargetUserId())
                .size();
        if (enrolled >= limit) {
            Slog.w(TAG, "Too many faces registered, user: " + getTargetUserId());
            Slog.w(TAG, "Too many fingerprints registered, user: " + getTargetUserId());
            return true;
        }
        return false;