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

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

Consolidate registration of HIDL and AIDL HALs

This CL establishes a single flow of registration for both HIDL and
AIDL HALs. The registration of both is done on a separate thread to
avoid blocking system server. Previously, only AIDL registration was
done on a separate thread.

Bug: 184677066
Test: atest CtsBiometricsTestCases
Test: atest AuthServiceTest
Test: atest Fingerprint21Test
Test: atest Face10Test

Change-Id: I4442db15a7b690bb34c6eb7e8793ab4411cbd6d2
parent c72ac760
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ public class SensorPropertiesInternal implements Parcelable {
                prop.resetLockoutRequiresHardwareAuthToken, prop.resetLockoutRequiresChallenge);
    }

    protected SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
    public SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
            int maxEnrollmentsPerUser, @NonNull List<ComponentInfoInternal> componentInfo,
            boolean resetLockoutRequiresHardwareAuthToken, boolean resetLockoutRequiresChallenge) {
        this.sensorId = sensorId;
+4 −2
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ interface IFaceService {
    void getFeature(IBinder token, int userId, int feature, IFaceServiceReceiver receiver,
            String opPackageName);

    // Give FaceService its ID. See AuthService.java
    void initializeConfiguration(int sensorId, int strength);
    // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because
    // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist,
    // hidlSensors must be non-null and empty. See AuthService.java
    void registerAuthenticators(in List<FaceSensorPropertiesInternal> hidlSensors);
}
+0 −29
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFP
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC;

import android.annotation.NonNull;
import android.content.Context;
import android.hardware.biometrics.ComponentInfoInternal;
import android.hardware.biometrics.SensorProperties;
import android.hardware.biometrics.SensorPropertiesInternal;
@@ -92,34 +91,6 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
                1636 /* sensorLocationY */, 130 /* sensorRadius */);
    }

    /**
     * Initializes SensorProperties with specified values and values obtained from resources using
     * context.
     */
    // TODO(b/179175438): Remove this constructor once all HALs move to AIDL.
    public FingerprintSensorPropertiesInternal(@NonNull Context context, int sensorId,
            @SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
            @NonNull List<ComponentInfoInternal> componentInfo,
            @FingerprintSensorProperties.SensorType int sensorType,
            boolean resetLockoutRequiresHardwareAuthToken) {
        super(sensorId, strength, maxEnrollmentsPerUser, componentInfo,
            resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */);
        this.sensorType = sensorType;

        int[] props = context.getResources().getIntArray(
                com.android.internal.R.array.config_udfps_sensor_props);
        if (props != null && props.length == 3) {
            this.sensorLocationX = props[0];
            this.sensorLocationY = props[1];
            this.sensorRadius = props[2];
        } else {
            // Fake coordinates that could be used for the fake UDFPS mode.
            this.sensorLocationX = 540;
            this.sensorLocationY = 1636;
            this.sensorRadius = 130;
        }
    }

    protected FingerprintSensorPropertiesInternal(Parcel in) {
        super(in);
        sensorType = in.readInt();
+4 −2
Original line number Diff line number Diff line
@@ -144,8 +144,10 @@ interface IFingerprintService {
    // Removes a callback set by addClientActiveCallback
    void removeClientActiveCallback(IFingerprintClientActiveCallback callback);

    // Give FingerprintService its ID. See AuthService.java
    void initializeConfiguration(int sensorId, int strength);
    // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because
    // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist,
    // hidlSensors must be non-null and empty. See AuthService.java
    void registerAuthenticators(in List<FingerprintSensorPropertiesInternal> hidlSensors);

    // Notifies about a finger touching the sensor area.
    void onPointerDown(int sensorId, int x, int y, float minor, float major);
+6 −2
Original line number Diff line number Diff line
@@ -15,12 +15,16 @@
 */
package android.hardware.iris;

import android.hardware.biometrics.SensorPropertiesInternal;

/**
 * Communication channel from client to the iris service. These methods are all require the
 * MANAGE_BIOMETRIC signature permission.
 * @hide
 */
interface IIrisService {
    // Give IrisService its ID. See AuthService.java
    void initializeConfiguration(int sensorId, int strength);
    // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because
    // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist,
    // hidlSensors must be non-null and empty. See AuthService.java
    void registerAuthenticators(in List<SensorPropertiesInternal> hidlSensors);
}
Loading