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

Commit fdf810a4 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Update framework for fingerprint and multi-biometric CTS

Bug: 173453845
Test: atest CtsBiometricsTestCases

Change-Id: I9d43f362570a2b610af7bfb07c112e0904acc8f4
parent 9a654b28
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -16,13 +16,10 @@

package android.hardware.biometrics;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * The base class containing all modality-agnostic information. This is a superset of the
 * {@link android.hardware.biometrics.common.CommonProps}, and provides backwards-compatible
@@ -35,6 +32,11 @@ public class SensorPropertiesInternal implements Parcelable {
    @SensorProperties.Strength public final int sensorStrength;
    public final int maxEnrollmentsPerUser;

    public static SensorPropertiesInternal from(@NonNull SensorPropertiesInternal prop) {
        return new SensorPropertiesInternal(prop.sensorId, prop.sensorStrength,
                prop.maxEnrollmentsPerUser);
    }

    protected SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
            int maxEnrollmentsPerUser) {
        this.sensorId = sensorId;
@@ -72,4 +74,10 @@ public class SensorPropertiesInternal implements Parcelable {
        dest.writeInt(sensorStrength);
        dest.writeInt(maxEnrollmentsPerUser);
    }

    @Override
    public String toString() {
        return "ID: " + sensorId + ", Strength: " + sensorStrength
                + ", MaxEnrollmentsPerUser: " + maxEnrollmentsPerUser;
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.hardware.face;
import android.hardware.biometrics.SensorProperties;
import android.hardware.biometrics.SensorPropertiesInternal;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Container for face sensor properties.
@@ -78,4 +77,9 @@ public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {
        dest.writeBoolean(supportsFaceDetection);
        dest.writeBoolean(supportsSelfIllumination);
    }

    @Override
    public String toString() {
        return "ID: " + sensorId + ", Strength: " + sensorStrength;
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -500,7 +500,11 @@ public class BiometricService extends SystemService {

            final List<SensorPropertiesInternal> sensors = new ArrayList<>();
            for (BiometricSensor sensor : mSensors) {
                sensors.add(sensor.impl.getSensorProperties(opPackageName));
                // Explicitly re-create as the super class, since AIDL doesn't play nicely with
                // "List<? extends SensorPropertiesInternal> ...
                final SensorPropertiesInternal prop = SensorPropertiesInternal
                        .from(sensor.impl.getSensorProperties(opPackageName));
                sensors.add(prop);
            }

            return sensors;
+6 −6
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ import java.util.List;
 * Provider for a single instance of the {@link IFace} HAL.
 */
public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
    private static final String TAG = "FaceProvider";
    private static final int ENROLL_TIMEOUT_SEC = 75;

    private boolean mTestHalEnabled;
@@ -88,7 +87,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
        public void onTaskStackChanged() {
            mHandler.post(() -> {
                for (int i = 0; i < mSensors.size(); i++) {
                    final ClientMonitor<?> client = mSensors.get(i).getScheduler()
                    final ClientMonitor<?> client = mSensors.valueAt(i).getScheduler()
                            .getCurrentClient();
                    if (!(client instanceof AuthenticationClient)) {
                        Slog.e(getTag(), "Task stack changed for client: " + client);
@@ -108,7 +107,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
                                    && !client.isAlreadyDone()) {
                                Slog.e(getTag(), "Stopping background authentication, top: "
                                        + topPackage + " currentClient: " + client);
                                mSensors.get(i).getScheduler()
                                mSensors.valueAt(i).getScheduler()
                                        .cancelAuthentication(client.getToken());
                            }
                        }
@@ -550,12 +549,13 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {

        JSONObject dump = new JSONObject();
        try {
            dump.put("service", "Face Manager");
            dump.put("service", getTag());

            JSONArray sets = new JSONArray();
            for (UserInfo user : UserManager.get(mContext).getUsers()) {
                final int userId = user.getUserHandle().getIdentifier();
                final int c = FaceUtils.getInstance().getBiometricsForUser(mContext, userId).size();
                final int c = FaceUtils.getInstance(sensorId)
                        .getBiometricsForUser(mContext, userId).size();
                JSONObject set = new JSONObject();
                set.put("id", userId);
                set.put("count", c);
@@ -574,7 +574,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {

            dump.put("prints", sets);
        } catch (JSONException e) {
            Slog.e(TAG, "dump formatting failure", e);
            Slog.e(getTag(), "dump formatting failure", e);
        }
        pw.println(dump);
        pw.println("HAL deaths since last reboot: " + performanceTracker.getHALDeathCount());
+1 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.hardware.common.NativeHandle;
import android.hardware.keymaster.HardwareAuthToken;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;

/**
 * Test session that provides mostly no-ops.
@@ -59,7 +58,7 @@ public class TestSession extends ISession.Stub {
    public ICancellationSignal authenticate(int cookie, long operationId) {
        return new ICancellationSignal() {
            @Override
            public void cancel() throws RemoteException {
            public void cancel() {
                mHalSessionCallback.onError(Error.CANCELED, 0 /* vendorCode */);
            }

Loading