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

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

Update lockout-related properties for easier understandability

1) resetLockoutRequiresHardwareAuthToken is moved to the base
   SensorPropertiesinternal class, despite face always requiring
   it. This will be clearer, since we are further splitting
   resetLockout logic into "challenge-required" (IBiometricsFace@1.0)
   and "challenge-less" (IFace@1.0) It would be weird to have
   a "resetLockoutRequiresChallenge" property without a
   "resetLockoutRequiresHardwareAuthToken" property.

2) Will be adding a resetLockoutRequiresChallenge to
   SensorPropertiesInternal in the next CL.

Bug: 182327296
Test: reset lockout on Pixel4
Change-Id: Ifa4b36dc42d91e967506a59d2880f47f61ec6cdf
parent b4dfa621
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -31,23 +31,26 @@ public class SensorPropertiesInternal implements Parcelable {
    public final int sensorId;
    @SensorProperties.Strength public final int sensorStrength;
    public final int maxEnrollmentsPerUser;
    public final boolean resetLockoutRequiresHardwareAuthToken;

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

    protected SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
            int maxEnrollmentsPerUser) {
            int maxEnrollmentsPerUser, boolean resetLockoutRequiresHardwareAuthToken) {
        this.sensorId = sensorId;
        this.sensorStrength = sensorStrength;
        this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
        this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
    }

    protected SensorPropertiesInternal(Parcel in) {
        sensorId = in.readInt();
        sensorStrength = in.readInt();
        maxEnrollmentsPerUser = in.readInt();
        resetLockoutRequiresHardwareAuthToken = in.readBoolean();
    }

    public static final Creator<SensorPropertiesInternal> CREATOR =
@@ -73,6 +76,7 @@ public class SensorPropertiesInternal implements Parcelable {
        dest.writeInt(sensorId);
        dest.writeInt(sensorStrength);
        dest.writeInt(maxEnrollmentsPerUser);
        dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
    }

    @Override
+4 −1
Original line number Diff line number Diff line
@@ -42,7 +42,10 @@ public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {
    public FaceSensorPropertiesInternal(int sensorId, @SensorProperties.Strength int strength,
            int maxEnrollmentsPerUser, boolean supportsFaceDetection,
            boolean supportsSelfIllumination) {
        super(sensorId, strength, maxEnrollmentsPerUser);
        // resetLockout is managed by the HAL and requires a HardwareAuthToken for all face
        // HAL interfaces (IBiometricsFace@1.0 HIDL and IFace@1.0 AIDL).
        super(sensorId, strength, maxEnrollmentsPerUser,
                true /* resetLockoutRequiresHardwareAuthToken */);
        this.supportsFaceDetection = supportsFaceDetection;
        this.supportsSelfIllumination = supportsSelfIllumination;
    }
+2 −12
Original line number Diff line number Diff line
@@ -35,12 +35,6 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
     */
    public final @FingerprintSensorProperties.SensorType int sensorType;

    /**
     * IBiometricsFingerprint@2.1 does not manage timeout below the HAL, so the Gatekeeper HAT
     * cannot be checked
     */
    public final boolean resetLockoutRequiresHardwareAuthToken;

    /**
     * The location of the center of the sensor if applicable. For example, sensors of type
     * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the
@@ -68,9 +62,8 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
            @FingerprintSensorProperties.SensorType int sensorType,
            boolean resetLockoutRequiresHardwareAuthToken, int sensorLocationX, int sensorLocationY,
            int sensorRadius) {
        super(sensorId, strength, maxEnrollmentsPerUser);
        super(sensorId, strength, maxEnrollmentsPerUser, resetLockoutRequiresHardwareAuthToken);
        this.sensorType = sensorType;
        this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
        this.sensorLocationX = sensorLocationX;
        this.sensorLocationY = sensorLocationY;
        this.sensorRadius = sensorRadius;
@@ -98,9 +91,8 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
            @SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
            @FingerprintSensorProperties.SensorType int sensorType,
            boolean resetLockoutRequiresHardwareAuthToken) {
        super(sensorId, strength, maxEnrollmentsPerUser);
        super(sensorId, strength, maxEnrollmentsPerUser, resetLockoutRequiresHardwareAuthToken);
        this.sensorType = sensorType;
        this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;

        int[] props = context.getResources().getIntArray(
                com.android.internal.R.array.config_udfps_sensor_props);
@@ -119,7 +111,6 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
    protected FingerprintSensorPropertiesInternal(Parcel in) {
        super(in);
        sensorType = in.readInt();
        resetLockoutRequiresHardwareAuthToken = in.readBoolean();
        sensorLocationX = in.readInt();
        sensorLocationY = in.readInt();
        sensorRadius = in.readInt();
@@ -147,7 +138,6 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeInt(sensorType);
        dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
        dest.writeInt(sensorLocationX);
        dest.writeInt(sensorLocationY);
        dest.writeInt(sensorRadius);
+2 −1
Original line number Diff line number Diff line
@@ -347,7 +347,8 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
        final @FingerprintSensorProperties.SensorType int sensorType =
                mIsUdfps ? FingerprintSensorProperties.TYPE_UDFPS_OPTICAL
                        : FingerprintSensorProperties.TYPE_REAR;
        // resetLockout is controlled by the framework, so hardwareAuthToken is not required
        // IBiometricsFingerprint@2.1 does not manage timeout below the HAL, so the Gatekeeper HAT
        // cannot be checked
        final boolean resetLockoutRequiresHardwareAuthToken = false;
        final int maxEnrollmentsPerUser = mContext.getResources()
                .getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);