From dd77d27c1342b01c428dbc152f2463dbaaa87937 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Mon, 15 Mar 2021 16:54:29 -0700 Subject: [PATCH] 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 --- .../biometrics/SensorPropertiesInternal.java | 8 ++++++-- .../face/FaceSensorPropertiesInternal.java | 5 ++++- .../FingerprintSensorPropertiesInternal.java | 14 ++------------ .../sensors/fingerprint/hidl/Fingerprint21.java | 3 ++- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/core/java/android/hardware/biometrics/SensorPropertiesInternal.java b/core/java/android/hardware/biometrics/SensorPropertiesInternal.java index 0b81c6c8cc25a..32d8bb5e94f60 100644 --- a/core/java/android/hardware/biometrics/SensorPropertiesInternal.java +++ b/core/java/android/hardware/biometrics/SensorPropertiesInternal.java @@ -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 CREATOR = @@ -73,6 +76,7 @@ public class SensorPropertiesInternal implements Parcelable { dest.writeInt(sensorId); dest.writeInt(sensorStrength); dest.writeInt(maxEnrollmentsPerUser); + dest.writeBoolean(resetLockoutRequiresHardwareAuthToken); } @Override diff --git a/core/java/android/hardware/face/FaceSensorPropertiesInternal.java b/core/java/android/hardware/face/FaceSensorPropertiesInternal.java index b9c0d12de22ba..504f90c43e57f 100644 --- a/core/java/android/hardware/face/FaceSensorPropertiesInternal.java +++ b/core/java/android/hardware/face/FaceSensorPropertiesInternal.java @@ -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; } diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java index 51addc95ac79c..536b5d779741b 100644 --- a/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java +++ b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java @@ -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); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java index 6e22a797b435b..cc3b569a73776 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java @@ -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);