summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kevin Chyn <kchyn@google.com> 2020-09-28 09:40:21 -0700
committer Kevin Chyn <kchyn@google.com> 2020-09-30 11:44:07 -0700
commitbb1d1c52b975283914de0e9c9ce297b61a08183f (patch)
tree606ba3a9dd1de4ddaaa53cda04c726956ff81bde
parented18d8085569642cd4507a14ecb1293cc4d19bf4 (diff)
Rename existing getSensorProperties, prepare for TestApi
Parcelables cannot easily become TestApi, since CREATOR, etc all come as extra baggage. So, rename internal usage to *SensorPropertiesInternal, and add a new class that exposes only specific parts of the properties for future TestApi Bug: 169459906 Test: Enroll, Auth on existing devices Test: atest com.android.systemui.biometrics Test: atest com.android.server.biometrics Change-Id: I59ae6bd30bef0eccbbcb58ddd7fa443be8a42ccf
-rw-r--r--core/java/android/hardware/biometrics/SensorProperties.java87
-rw-r--r--core/java/android/hardware/biometrics/SensorPropertiesInternal.java75
-rw-r--r--core/java/android/hardware/face/FaceManager.java33
-rw-r--r--core/java/android/hardware/face/FaceSensorProperties.java69
-rw-r--r--core/java/android/hardware/face/FaceSensorPropertiesInternal.aidl (renamed from core/java/android/hardware/face/FaceSensorProperties.aidl)2
-rw-r--r--core/java/android/hardware/face/FaceSensorPropertiesInternal.java81
-rw-r--r--core/java/android/hardware/face/IFaceService.aidl4
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintManager.java25
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintSensorProperties.java98
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.aidl (renamed from core/java/android/hardware/fingerprint/FingerprintSensorProperties.aidl)2
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java88
-rw-r--r--core/java/android/hardware/fingerprint/IFingerprintService.aidl4
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java7
-rw-r--r--services/core/java/com/android/server/biometrics/Utils.java4
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/Face10.java11
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/FaceService.java8
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java17
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java8
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java9
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21UdfpsMock.java9
-rw-r--r--services/core/java/com/android/server/locksettings/BiometricDeferredQueue.java19
27 files changed, 472 insertions, 230 deletions
diff --git a/core/java/android/hardware/biometrics/SensorProperties.java b/core/java/android/hardware/biometrics/SensorProperties.java
index 0f33ac4f0568..b3dcb8f70532 100644
--- a/core/java/android/hardware/biometrics/SensorProperties.java
+++ b/core/java/android/hardware/biometrics/SensorProperties.java
@@ -17,66 +17,71 @@
package android.hardware.biometrics;
import android.annotation.IntDef;
-import android.os.Parcel;
-import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
- * The base class containing all sensor-agnostic information. This is a superset of the
- * {@link android.hardware.biometrics.common.CommonProps}, and provides backwards-compatible
- * behavior with the older generation of HIDL (non-AIDL) interfaces.
+ * The base class containing all modality-agnostic information.
* @hide
*/
-public class SensorProperties implements Parcelable {
-
+public class SensorProperties {
+ /**
+ * A sensor that meets the requirements for Class 1 biometrics as defined in the CDD. This does
+ * not correspond to a public BiometricManager.Authenticators constant. Sensors of this strength
+ * are not available to applications via the public API surface.
+ * @hide
+ */
public static final int STRENGTH_CONVENIENCE = 0;
+
+ /**
+ * A sensor that meets the requirements for Class 2 biometrics as defined in the CDD.
+ * Corresponds to BiometricManager.Authenticators.BIOMETRIC_WEAK.
+ * @hide
+ */
public static final int STRENGTH_WEAK = 1;
+
+ /**
+ * A sensor that meets the requirements for Class 3 biometrics as defined in the CDD.
+ * Corresponds to BiometricManager.Authenticators.BIOMETRIC_STRONG.
+ *
+ * Notably, this is the only strength that allows generation of HardwareAuthToken(s).
+ * @hide
+ */
public static final int STRENGTH_STRONG = 2;
+ /**
+ * @hide
+ */
@IntDef({STRENGTH_CONVENIENCE, STRENGTH_WEAK, STRENGTH_STRONG})
@Retention(RetentionPolicy.SOURCE)
public @interface Strength {}
- public final int sensorId;
- @Strength public final int sensorStrength;
- public final int maxEnrollmentsPerUser;
+ private final int mSensorId;
+ @Strength private final int mSensorStrength;
- protected SensorProperties(int sensorId, @Strength int sensorStrength,
- int maxEnrollmentsPerUser) {
- this.sensorId = sensorId;
- this.sensorStrength = sensorStrength;
- this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
+ /**
+ * @hide
+ */
+ public SensorProperties(int sensorId, @Strength int sensorStrength) {
+ mSensorId = sensorId;
+ mSensorStrength = sensorStrength;
}
- protected SensorProperties(Parcel in) {
- sensorId = in.readInt();
- sensorStrength = in.readInt();
- maxEnrollmentsPerUser = in.readInt();
- }
-
- public static final Creator<SensorProperties> CREATOR = new Creator<SensorProperties>() {
- @Override
- public SensorProperties createFromParcel(Parcel in) {
- return new SensorProperties(in);
- }
-
- @Override
- public SensorProperties[] newArray(int size) {
- return new SensorProperties[size];
- }
- };
-
- @Override
- public int describeContents() {
- return 0;
+ /**
+ * @return The sensor's unique identifier.
+ * @hide
+ */
+ public int getSensorId() {
+ return mSensorId;
}
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(sensorId);
- dest.writeInt(sensorStrength);
- dest.writeInt(maxEnrollmentsPerUser);
+ /**
+ * @return The sensor's strength.
+ * @hide
+ */
+ @Strength
+ public int getSensorStrength() {
+ return mSensorStrength;
}
}
diff --git a/core/java/android/hardware/biometrics/SensorPropertiesInternal.java b/core/java/android/hardware/biometrics/SensorPropertiesInternal.java
new file mode 100644
index 000000000000..2189de0827b7
--- /dev/null
+++ b/core/java/android/hardware/biometrics/SensorPropertiesInternal.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics;
+
+import android.annotation.IntDef;
+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
+ * behavior with the older generation of HIDL (non-AIDL) interfaces.
+ * @hide
+ */
+public class SensorPropertiesInternal implements Parcelable {
+
+ public final int sensorId;
+ @SensorProperties.Strength public final int sensorStrength;
+ public final int maxEnrollmentsPerUser;
+
+ protected SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
+ int maxEnrollmentsPerUser) {
+ this.sensorId = sensorId;
+ this.sensorStrength = sensorStrength;
+ this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
+ }
+
+ protected SensorPropertiesInternal(Parcel in) {
+ sensorId = in.readInt();
+ sensorStrength = in.readInt();
+ maxEnrollmentsPerUser = in.readInt();
+ }
+
+ public static final Creator<SensorPropertiesInternal> CREATOR =
+ new Creator<SensorPropertiesInternal>() {
+ @Override
+ public SensorPropertiesInternal createFromParcel(Parcel in) {
+ return new SensorPropertiesInternal(in);
+ }
+
+ @Override
+ public SensorPropertiesInternal[] newArray(int size) {
+ return new SensorPropertiesInternal[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(sensorId);
+ dest.writeInt(sensorStrength);
+ dest.writeInt(maxEnrollmentsPerUser);
+ }
+}
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 1b114d3528a2..e65d7b5965d5 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -49,9 +49,6 @@ import com.android.internal.os.SomeArgs;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
/**
* A class that coordinates access to the face authentication hardware.
@@ -299,6 +296,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
* int[], Surface)} with {@code surface} set to null.
*
* @see FaceManager#enroll(int, byte[], CancellationSignal, EnrollmentCallback, int[], Surface)
+ * @hide
*/
@RequiresPermission(MANAGE_BIOMETRIC)
public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
@@ -443,7 +441,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
*/
@RequiresPermission(MANAGE_BIOMETRIC)
public void generateChallenge(GenerateChallengeCallback callback) {
- final List<FaceSensorProperties> faceSensorProperties = getSensorProperties();
+ final List<FaceSensorPropertiesInternal> faceSensorProperties =
+ getSensorPropertiesInternal();
if (faceSensorProperties.isEmpty()) {
Slog.e(TAG, "No sensors");
return;
@@ -460,7 +459,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
*/
@RequiresPermission(MANAGE_BIOMETRIC)
public void revokeChallenge() {
- final List<FaceSensorProperties> faceSensorProperties = getSensorProperties();
+ final List<FaceSensorPropertiesInternal> faceSensorProperties =
+ getSensorPropertiesInternal();
if (faceSensorProperties.isEmpty()) {
Slog.e(TAG, "No sensors during revokeChallenge");
}
@@ -597,6 +597,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
* Determine if there is a face enrolled.
*
* @return true if a face is enrolled, false otherwise
+ * @hide
*/
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
public boolean hasEnrolledTemplates() {
@@ -632,6 +633,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
* Determine if face authentication sensor hardware is present and functional.
*
* @return true if hardware is present and functional, false otherwise.
+ * @hide
*/
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
public boolean isHardwareDetected() {
@@ -648,17 +650,32 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
}
/**
+ * Retrieves a list of properties for all face authentication sensors on the device.
+ * @hide
+ */
+ @NonNull
+ public List<FaceSensorProperties> getSensorProperties() {
+ final List<FaceSensorProperties> properties = new ArrayList<>();
+ final List<FaceSensorPropertiesInternal> internalProperties
+ = getSensorPropertiesInternal();
+ for (FaceSensorPropertiesInternal internalProp : internalProperties) {
+ properties.add(FaceSensorProperties.from(internalProp));
+ }
+ return properties;
+ }
+
+ /**
* Get statically configured sensor properties.
* @hide
*/
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
@NonNull
- public List<FaceSensorProperties> getSensorProperties() {
+ public List<FaceSensorPropertiesInternal> getSensorPropertiesInternal() {
try {
if (mService == null || !mService.isHardwareDetected(mContext.getOpPackageName())) {
return new ArrayList<>();
}
- return mService.getSensorProperties(mContext.getOpPackageName());
+ return mService.getSensorPropertiesInternal(mContext.getOpPackageName());
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
@@ -874,6 +891,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
/**
* Container for callback data from {@link FaceManager#authenticate(CryptoObject,
* CancellationSignal, int, AuthenticationCallback, Handler)}.
+ * @hide
*/
public static class AuthenticationResult {
private Face mFace;
@@ -943,6 +961,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
* FaceManager#authenticate(CryptoObject, CancellationSignal,
* int, AuthenticationCallback, Handler) } must provide an implementation of this for listening
* to face events.
+ * @hide
*/
public abstract static class AuthenticationCallback
extends BiometricAuthenticator.AuthenticationCallback {
diff --git a/core/java/android/hardware/face/FaceSensorProperties.java b/core/java/android/hardware/face/FaceSensorProperties.java
index 23ad9353a206..e61d93166cc5 100644
--- a/core/java/android/hardware/face/FaceSensorProperties.java
+++ b/core/java/android/hardware/face/FaceSensorProperties.java
@@ -16,76 +16,25 @@
package android.hardware.face;
-import android.os.Parcel;
-import android.os.Parcelable;
+import android.hardware.biometrics.SensorProperties;
/**
* Container for face sensor properties.
* @hide
*/
-public class FaceSensorProperties implements Parcelable {
+public class FaceSensorProperties extends SensorProperties {
/**
- * A statically configured ID representing this sensor. Sensor IDs must be unique across all
- * biometrics across the device, starting at 0, and in increments of 1.
+ * @hide
*/
- public final int sensorId;
- /**
- * True if the sensor is able to perform generic face detection, without running the
- * matching algorithm, and without affecting the lockout counter.
- */
- public final boolean supportsFaceDetection;
- /**
- * True if the sensor is able to provide self illumination in dark scenarios, without support
- * from above the HAL.
- */
- public final boolean supportsSelfIllumination;
- /**
- * Maximum number of enrollments a user/profile can have.
- */
- public final int maxTemplatesAllowed;
-
+ public static FaceSensorProperties from(FaceSensorPropertiesInternal internalProp) {
+ return new FaceSensorProperties(internalProp.sensorId, internalProp.sensorStrength);
+ }
/**
- * Initializes SensorProperties with specified values
+ * @hide
*/
- public FaceSensorProperties(int sensorId, boolean supportsFaceDetection,
- boolean supportsSelfIllumination, int maxTemplatesAllowed) {
- this.sensorId = sensorId;
- this.supportsFaceDetection = supportsFaceDetection;
- this.supportsSelfIllumination = supportsSelfIllumination;
- this.maxTemplatesAllowed = maxTemplatesAllowed;
+ public FaceSensorProperties(int sensorId, int sensorStrength) {
+ super(sensorId, sensorStrength);
}
- protected FaceSensorProperties(Parcel in) {
- sensorId = in.readInt();
- supportsFaceDetection = in.readBoolean();
- supportsSelfIllumination = in.readBoolean();
- maxTemplatesAllowed = in.readInt();
- }
-
- public static final Creator<FaceSensorProperties> CREATOR =
- new Creator<FaceSensorProperties>() {
- @Override
- public FaceSensorProperties createFromParcel(Parcel in) {
- return new FaceSensorProperties(in);
- }
-
- @Override
- public FaceSensorProperties[] newArray(int size) {
- return new FaceSensorProperties[size];
- }
- };
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(sensorId);
- dest.writeBoolean(supportsFaceDetection);
- dest.writeBoolean(supportsSelfIllumination);
- dest.writeInt(maxTemplatesAllowed);
- }
}
diff --git a/core/java/android/hardware/face/FaceSensorProperties.aidl b/core/java/android/hardware/face/FaceSensorPropertiesInternal.aidl
index d83ee4b17fa7..75bc250f52e2 100644
--- a/core/java/android/hardware/face/FaceSensorProperties.aidl
+++ b/core/java/android/hardware/face/FaceSensorPropertiesInternal.aidl
@@ -15,4 +15,4 @@
*/
package android.hardware.face;
-parcelable FaceSensorProperties; \ No newline at end of file
+parcelable FaceSensorPropertiesInternal; \ No newline at end of file
diff --git a/core/java/android/hardware/face/FaceSensorPropertiesInternal.java b/core/java/android/hardware/face/FaceSensorPropertiesInternal.java
new file mode 100644
index 000000000000..e91554b532b0
--- /dev/null
+++ b/core/java/android/hardware/face/FaceSensorPropertiesInternal.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.
+ * @hide
+ */
+public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {
+ /**
+ * True if the sensor is able to perform generic face detection, without running the
+ * matching algorithm, and without affecting the lockout counter.
+ */
+ public final boolean supportsFaceDetection;
+ /**
+ * True if the sensor is able to provide self illumination in dark scenarios, without support
+ * from above the HAL.
+ */
+ public final boolean supportsSelfIllumination;
+
+ /**
+ * Initializes SensorProperties with specified values
+ */
+ public FaceSensorPropertiesInternal(int sensorId, @SensorProperties.Strength int strength,
+ int maxEnrollmentsPerUser, boolean supportsFaceDetection,
+ boolean supportsSelfIllumination) {
+ super(sensorId, strength, maxEnrollmentsPerUser);
+ this.supportsFaceDetection = supportsFaceDetection;
+ this.supportsSelfIllumination = supportsSelfIllumination;
+ }
+
+ protected FaceSensorPropertiesInternal(Parcel in) {
+ super(in);
+ supportsFaceDetection = in.readBoolean();
+ supportsSelfIllumination = in.readBoolean();
+ }
+
+ public static final Creator<FaceSensorPropertiesInternal> CREATOR =
+ new Creator<FaceSensorPropertiesInternal>() {
+ @Override
+ public FaceSensorPropertiesInternal createFromParcel(Parcel in) {
+ return new FaceSensorPropertiesInternal(in);
+ }
+
+ @Override
+ public FaceSensorPropertiesInternal[] newArray(int size) {
+ return new FaceSensorPropertiesInternal[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ dest.writeBoolean(supportsFaceDetection);
+ dest.writeBoolean(supportsSelfIllumination);
+ }
+}
diff --git a/core/java/android/hardware/face/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl
index e744c840c298..b85b6f7d8174 100644
--- a/core/java/android/hardware/face/IFaceService.aidl
+++ b/core/java/android/hardware/face/IFaceService.aidl
@@ -19,7 +19,7 @@ import android.hardware.biometrics.IBiometricSensorReceiver;
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
import android.hardware.face.IFaceServiceReceiver;
import android.hardware.face.Face;
-import android.hardware.face.FaceSensorProperties;
+import android.hardware.face.FaceSensorPropertiesInternal;
import android.view.Surface;
/**
@@ -29,7 +29,7 @@ import android.view.Surface;
*/
interface IFaceService {
// Retrieve static sensor properties for all face sensors
- List<FaceSensorProperties> getSensorProperties(String opPackageName);
+ List<FaceSensorPropertiesInternal> getSensorPropertiesInternal(String opPackageName);
// Authenticate the given sessionId with a face
void authenticate(IBinder token, long operationId, int userid, IFaceServiceReceiver receiver,
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index 997efbedb0de..23de303efae6 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -53,10 +53,7 @@ import android.view.Surface;
import java.security.Signature;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
import javax.crypto.Cipher;
import javax.crypto.Mac;
@@ -608,7 +605,8 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
*/
@RequiresPermission(MANAGE_FINGERPRINT)
public void generateChallenge(GenerateChallengeCallback callback) {
- final List<FingerprintSensorProperties> fingerprintSensorProperties = getSensorProperties();
+ final List<FingerprintSensorPropertiesInternal> fingerprintSensorProperties =
+ getSensorPropertiesInternal();
if (fingerprintSensorProperties.isEmpty()) {
Slog.e(TAG, "No sensors");
return;
@@ -850,17 +848,32 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
}
/**
+ * Retrieves a list of properties for all fingerprint sensors on the device.
+ * @hide
+ */
+ @NonNull
+ public List<FingerprintSensorProperties> getSensorProperties() {
+ final List<FingerprintSensorProperties> properties = new ArrayList<>();
+ final List<FingerprintSensorPropertiesInternal> internalProperties
+ = getSensorPropertiesInternal();
+ for (FingerprintSensorPropertiesInternal internalProp : internalProperties) {
+ properties.add(FingerprintSensorProperties.from(internalProp));
+ }
+ return properties;
+ }
+
+ /**
* Get statically configured sensor properties.
* @hide
*/
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
@NonNull
- public List<FingerprintSensorProperties> getSensorProperties() {
+ public List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal() {
try {
if (mService == null || !mService.isHardwareDetected(mContext.getOpPackageName())) {
return new ArrayList<>();
}
- return mService.getSensorProperties(mContext.getOpPackageName());
+ return mService.getSensorPropertiesInternal(mContext.getOpPackageName());
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java b/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java
index d26346c21427..684d7d9cf0a0 100644
--- a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java
+++ b/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java
@@ -18,7 +18,6 @@ package android.hardware.fingerprint;
import android.annotation.IntDef;
import android.hardware.biometrics.SensorProperties;
-import android.os.Parcel;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -28,14 +27,39 @@ import java.lang.annotation.RetentionPolicy;
* @hide
*/
public class FingerprintSensorProperties extends SensorProperties {
-
+ /**
+ * @hide
+ */
public static final int TYPE_UNKNOWN = 0;
+
+ /**
+ * @hide
+ */
public static final int TYPE_REAR = 1;
+
+ /**
+ * @hide
+ */
public static final int TYPE_UDFPS_ULTRASONIC = 2;
+
+ /**
+ * @hide
+ */
public static final int TYPE_UDFPS_OPTICAL = 3;
+
+ /**
+ * @hide
+ */
public static final int TYPE_POWER_BUTTON = 4;
+
+ /**
+ * @hide
+ */
public static final int TYPE_HOME_BUTTON = 5;
+ /**
+ * @hide
+ */
@IntDef({TYPE_UNKNOWN,
TYPE_REAR,
TYPE_UDFPS_ULTRASONIC,
@@ -45,60 +69,34 @@ public class FingerprintSensorProperties extends SensorProperties {
@Retention(RetentionPolicy.SOURCE)
public @interface SensorType {}
- public final @SensorType int sensorType;
- // IBiometricsFingerprint@2.1 does not manage timeout below the HAL, so the Gatekeeper HAT
- // cannot be checked
- public final boolean resetLockoutRequiresHardwareAuthToken;
+ @SensorType final int mSensorType;
/**
- * Initializes SensorProperties with specified values
+ * Constructs a {@link FingerprintSensorProperties} from the internal parcelable representation.
+ * @hide
*/
- public FingerprintSensorProperties(int sensorId, @Strength int strength,
- int maxEnrollmentsPerUser, @SensorType int sensorType,
- boolean resetLockoutRequiresHardwareAuthToken) {
- super(sensorId, strength, maxEnrollmentsPerUser);
- this.sensorType = sensorType;
- this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
- }
-
- protected FingerprintSensorProperties(Parcel in) {
- super(in);
- sensorType = in.readInt();
- resetLockoutRequiresHardwareAuthToken = in.readBoolean();
+ public static FingerprintSensorProperties from(
+ FingerprintSensorPropertiesInternal internalProp) {
+ return new FingerprintSensorProperties(internalProp.sensorId,
+ internalProp.sensorStrength,
+ internalProp.sensorType);
}
- public static final Creator<FingerprintSensorProperties> CREATOR =
- new Creator<FingerprintSensorProperties>() {
- @Override
- public FingerprintSensorProperties createFromParcel(Parcel in) {
- return new FingerprintSensorProperties(in);
- }
-
- @Override
- public FingerprintSensorProperties[] newArray(int size) {
- return new FingerprintSensorProperties[size];
- }
- };
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags);
- dest.writeInt(sensorType);
- dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
+ /**
+ * @hide
+ */
+ public FingerprintSensorProperties(int sensorId, int sensorStrength,
+ @SensorType int sensorType) {
+ super(sensorId, sensorStrength);
+ mSensorType = sensorType;
}
- public boolean isAnyUdfpsType() {
- switch (sensorType) {
- case TYPE_UDFPS_OPTICAL:
- case TYPE_UDFPS_ULTRASONIC:
- return true;
- default:
- return false;
- }
+ /**
+ * @hide
+ * @return The sensor's type.
+ */
+ @SensorType
+ public int getSensorType() {
+ return mSensorType;
}
}
diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.aidl b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.aidl
index 83d853dd4048..51705ef89ef3 100644
--- a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.aidl
+++ b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.aidl
@@ -15,4 +15,4 @@
*/
package android.hardware.fingerprint;
-parcelable FingerprintSensorProperties; \ No newline at end of file
+parcelable FingerprintSensorPropertiesInternal; \ No newline at end of file
diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java
new file mode 100644
index 000000000000..d5ce9e3890b5
--- /dev/null
+++ b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.fingerprint;
+
+import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_OPTICAL;
+import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC;
+
+import android.hardware.biometrics.SensorProperties;
+import android.hardware.biometrics.SensorPropertiesInternal;
+import android.os.Parcel;
+
+/**
+ * Container for fingerprint sensor properties.
+ * @hide
+ */
+public class FingerprintSensorPropertiesInternal extends SensorPropertiesInternal {
+ 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;
+
+ /**
+ * Initializes SensorProperties with specified values
+ */
+ public FingerprintSensorPropertiesInternal(int sensorId,
+ @SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
+ @FingerprintSensorProperties.SensorType int sensorType,
+ boolean resetLockoutRequiresHardwareAuthToken) {
+ super(sensorId, strength, maxEnrollmentsPerUser);
+ this.sensorType = sensorType;
+ this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
+ }
+
+ protected FingerprintSensorPropertiesInternal(Parcel in) {
+ super(in);
+ sensorType = in.readInt();
+ resetLockoutRequiresHardwareAuthToken = in.readBoolean();
+ }
+
+ public static final Creator<FingerprintSensorPropertiesInternal> CREATOR =
+ new Creator<FingerprintSensorPropertiesInternal>() {
+ @Override
+ public FingerprintSensorPropertiesInternal createFromParcel(Parcel in) {
+ return new FingerprintSensorPropertiesInternal(in);
+ }
+
+ @Override
+ public FingerprintSensorPropertiesInternal[] newArray(int size) {
+ return new FingerprintSensorPropertiesInternal[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ dest.writeInt(sensorType);
+ dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
+ }
+
+ public boolean isAnyUdfpsType() {
+ switch (sensorType) {
+ case TYPE_UDFPS_OPTICAL:
+ case TYPE_UDFPS_ULTRASONIC:
+ return true;
+ default:
+ return false;
+ }
+ }
+}
diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
index 68013eae956b..7af73800d64e 100644
--- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl
+++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
@@ -21,7 +21,7 @@ import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.hardware.fingerprint.Fingerprint;
-import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.view.Surface;
import java.util.List;
@@ -31,7 +31,7 @@ import java.util.List;
*/
interface IFingerprintService {
// Retrieve static sensor properties for all fingerprint sensors
- List<FingerprintSensorProperties> getSensorProperties(String opPackageName);
+ List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal(String opPackageName);
// Authenticate the given sessionId with a fingerprint. This is protected by
// USE_FINGERPRINT/USE_BIOMETRIC permission. This is effectively deprecated, since it only comes
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 76090f87223e..bdb34bb56c57 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -56,7 +56,7 @@ import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.face.FaceManager;
-import android.hardware.face.FaceSensorProperties;
+import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
@@ -1336,7 +1336,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private CancellationSignal mFaceCancelSignal;
private FingerprintManager mFpm;
private FaceManager mFaceManager;
- private List<FaceSensorProperties> mFaceSensorProperties;
+ private List<FaceSensorPropertiesInternal> mFaceSensorProperties;
private boolean mFingerprintLockedOut;
private TelephonyManager mTelephonyManager;
@@ -1778,7 +1778,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
}
if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
mFaceManager = (FaceManager) context.getSystemService(Context.FACE_SERVICE);
- mFaceSensorProperties = mFaceManager.getSensorProperties();
+ mFaceSensorProperties = mFaceManager.getSensorPropertiesInternal();
}
if (mFpm != null || mFaceManager != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index 38a191c8fb06..b1ae56a584d2 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -36,7 +36,7 @@ import android.hardware.biometrics.IBiometricSysuiReceiver;
import android.hardware.biometrics.PromptInfo;
import android.hardware.face.FaceManager;
import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -306,9 +306,9 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
- final List<FingerprintSensorProperties> fingerprintSensorProperties =
- mFingerprintManager.getSensorProperties();
- for (FingerprintSensorProperties props : fingerprintSensorProperties) {
+ final List<FingerprintSensorPropertiesInternal> fingerprintSensorProperties =
+ mFingerprintManager.getSensorPropertiesInternal();
+ for (FingerprintSensorPropertiesInternal props : fingerprintSensorProperties) {
if (props.isAnyUdfpsType()) {
mUdfpsController = mUdfpsControllerFactory.get();
break;
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
index 289ffbe518c0..c409d87a098a 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
@@ -26,7 +26,7 @@ import android.content.res.TypedArray;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.os.PowerManager;
import android.os.UserHandle;
@@ -53,7 +53,6 @@ import com.android.systemui.util.settings.SystemSettings;
import java.io.FileWriter;
import java.io.IOException;
-import java.util.List;
import javax.inject.Inject;
@@ -182,7 +181,8 @@ class UdfpsController implements DozeReceiver {
mLayoutParams = createLayoutParams(context);
int udfpsSensorId = -1;
- for (FingerprintSensorProperties props : mFingerprintManager.getSensorProperties()) {
+ for (FingerprintSensorPropertiesInternal props :
+ mFingerprintManager.getSensorPropertiesInternal()) {
if (props.isAnyUdfpsType()) {
udfpsSensorId = props.sensorId;
break;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
index 9d8e73a0ff47..e50fd6a96b5c 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
@@ -134,7 +134,7 @@ public class KeyguardModule {
// Cameras that support "self illumination," via IR for example, don't need low light
// environment mitigation.
- boolean needsLowLightMitigation = faceManager.getSensorProperties().stream()
+ boolean needsLowLightMitigation = faceManager.getSensorPropertiesInternal().stream()
.anyMatch((properties) -> !properties.supportsSelfIllumination);
if (!needsLowLightMitigation) {
return Optional.empty();
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index d93cc05c57db..e73ed801b7df 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -53,6 +53,7 @@ import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorProperties;
+import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.fingerprint.FingerprintManager;
import android.media.AudioManager;
import android.os.Bundle;
@@ -132,7 +133,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
@Mock
private FaceManager mFaceManager;
@Mock
- private List<FaceSensorProperties> mFaceSensorProperties;
+ private List<FaceSensorPropertiesInternal> mFaceSensorProperties;
@Mock
private BiometricManager mBiometricManager;
@Mock
@@ -177,13 +178,14 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
when(mFaceManager.isHardwareDetected()).thenReturn(true);
when(mFaceManager.hasEnrolledTemplates()).thenReturn(true);
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
- when(mFaceManager.getSensorProperties()).thenReturn(mFaceSensorProperties);
+ when(mFaceManager.getSensorPropertiesInternal()).thenReturn(mFaceSensorProperties);
// IBiometricsFace@1.0 does not support detection, only authentication.
when(mFaceSensorProperties.isEmpty()).thenReturn(false);
- when(mFaceSensorProperties.get(anyInt())).thenReturn(new FaceSensorProperties(0 /* id */,
- false /* supportsFaceDetection */, true /* supportsSelfIllumination */,
- 1 /* maxTemplatesAllowed */));
+ when(mFaceSensorProperties.get(anyInt())).thenReturn(new FaceSensorPropertiesInternal(
+ 0 /* id */,
+ FaceSensorProperties.STRENGTH_STRONG, 1 /* maxTemplatesAllowed */,
+ false /* supportsFaceDetection */, true /* supportsSelfIllumination */));
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
index f6b39c2ca38b..e0420ca38f45 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
@@ -49,6 +49,7 @@ import android.hardware.biometrics.SensorProperties;
import android.hardware.face.FaceManager;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
@@ -120,14 +121,15 @@ public class AuthControllerTest extends SysuiTestCase {
when(mDialog2.isAllowDeviceCredentials()).thenReturn(false);
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
- FingerprintSensorProperties prop = new FingerprintSensorProperties(1 /* sensorId */,
+ FingerprintSensorPropertiesInternal prop = new FingerprintSensorPropertiesInternal(
+ 1 /* sensorId */,
SensorProperties.STRENGTH_STRONG,
1 /* maxEnrollmentsPerUser */,
FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
true /* resetLockoutRequireHardwareAuthToken */);
- List<FingerprintSensorProperties> props = new ArrayList<>();
+ List<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
props.add(prop);
- when(mFingerprintManager.getSensorProperties()).thenReturn(props);
+ when(mFingerprintManager.getSensorPropertiesInternal()).thenReturn(props);
mAuthController = new TestableAuthController(context, mCommandQueue,
mStatusBarStateController, mActivityTaskManager, mFingerprintManager,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
index 7df9f1fff844..99e39b8097eb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
@@ -30,6 +30,7 @@ import android.content.res.TypedArray;
import android.hardware.biometrics.SensorProperties;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.os.PowerManager;
import android.os.RemoteException;
@@ -109,13 +110,13 @@ public class UdfpsControllerTest extends SysuiTestCase {
public void setUp() {
setUpResources();
when(mLayoutInflater.inflate(R.layout.udfps_view, null, false)).thenReturn(mUdfpsView);
- final List<FingerprintSensorProperties> props = new ArrayList<>();
- props.add(new FingerprintSensorProperties(TEST_UDFPS_SENSOR_ID,
+ final List<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
+ props.add(new FingerprintSensorPropertiesInternal(TEST_UDFPS_SENSOR_ID,
SensorProperties.STRENGTH_STRONG,
5 /* maxEnrollmentsPerUser */,
FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
true /* resetLockoutRequiresHardwareAuthToken */));
- when(mFingerprintManager.getSensorProperties()).thenReturn(props);
+ when(mFingerprintManager.getSensorPropertiesInternal()).thenReturn(props);
mSystemSettings = new FakeSettings();
mFgExecutor = new FakeExecutor(new FakeSystemClock());
mUdfpsController = new UdfpsController(
diff --git a/services/core/java/com/android/server/biometrics/Utils.java b/services/core/java/com/android/server/biometrics/Utils.java
index c300169d0b39..88804e28480b 100644
--- a/services/core/java/com/android/server/biometrics/Utils.java
+++ b/services/core/java/com/android/server/biometrics/Utils.java
@@ -49,8 +49,10 @@ import android.hardware.biometrics.BiometricPrompt.AuthenticationResultType;
import android.hardware.biometrics.IBiometricService;
import android.hardware.biometrics.PromptInfo;
import android.hardware.biometrics.SensorProperties;
+import android.hardware.biometrics.SensorPropertiesInternal;
import android.os.Binder;
import android.os.Build;
+import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
@@ -448,7 +450,7 @@ public class Utils {
/**
* Converts from {@link BiometricManager.Authenticators} biometric strength to the internal
- * {@link SensorProperties} strength.
+ * {@link SensorPropertiesInternal} strength.
*/
public static @SensorProperties.Strength int authenticatorStrengthToPropertyStrength(
@BiometricManager.Authenticators.Types int strength) {
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/Face10.java b/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
index c17bc917071c..bff0c3c686ef 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
@@ -31,7 +31,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.face.V1_0.IBiometricsFace;
import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
import android.hardware.face.Face;
-import android.hardware.face.FaceSensorProperties;
+import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.face.IFaceServiceReceiver;
import android.os.Binder;
import android.os.Build;
@@ -87,7 +87,7 @@ class Face10 implements IHwBinder.DeathRecipient {
static final String NOTIFICATION_TAG = "FaceService";
static final int NOTIFICATION_ID = 1;
- @NonNull private final FaceSensorProperties mFaceSensorProperties;
+ @NonNull private final FaceSensorPropertiesInternal mFaceSensorProperties;
@NonNull private final Context mContext;
@NonNull private final BiometricScheduler mScheduler;
@NonNull private final Handler mHandler;
@@ -285,8 +285,8 @@ class Face10 implements IHwBinder.DeathRecipient {
.getBoolean(R.bool.config_faceAuthSupportsSelfIllumination);
final int maxTemplatesAllowed = context.getResources()
.getInteger(R.integer.config_faceMaxTemplatesPerUser);
- mFaceSensorProperties = new FaceSensorProperties(sensorId, false /* supportsFaceDetect */,
- supportsSelfIllumination, maxTemplatesAllowed);
+ mFaceSensorProperties = new FaceSensorPropertiesInternal(sensorId, strength,
+ maxTemplatesAllowed, false /* supportsFaceDetect */, supportsSelfIllumination);
mContext = context;
mSensorId = sensorId;
mScheduler = new BiometricScheduler(TAG, null /* gestureAvailabilityTracker */);
@@ -672,7 +672,8 @@ class Face10 implements IHwBinder.DeathRecipient {
return daemon != null;
}
- @NonNull FaceSensorProperties getFaceSensorProperties() {
+ @NonNull
+ FaceSensorPropertiesInternal getFaceSensorProperties() {
return mFaceSensorProperties;
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java b/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
index 82dc0d04d8a7..83f10c8e658b 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
@@ -26,7 +26,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.IBiometricSensorReceiver;
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
import android.hardware.face.Face;
-import android.hardware.face.FaceSensorProperties;
+import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.face.IFaceService;
import android.hardware.face.IFaceServiceReceiver;
import android.os.Binder;
@@ -67,9 +67,11 @@ public class FaceService extends SystemService {
*/
private final class FaceServiceWrapper extends IFaceService.Stub {
@Override // Binder call
- public List<FaceSensorProperties> getSensorProperties(String opPackageName) {
+ public List<FaceSensorPropertiesInternal> getSensorPropertiesInternal(
+ String opPackageName) {
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
- final List<FaceSensorProperties> properties = new ArrayList<>();
+
+ final List<FaceSensorPropertiesInternal> properties = new ArrayList<>();
if (mFace10 != null) {
properties.add(mFace10.getFaceSensorProperties());
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
index cc9407913be9..d353994b7f9a 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
@@ -33,7 +33,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.IBiometricSensorReceiver;
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
import android.hardware.fingerprint.Fingerprint;
-import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintService;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
@@ -87,9 +87,11 @@ public class FingerprintService extends SystemService {
*/
private final class FingerprintServiceWrapper extends IFingerprintService.Stub {
@Override // Binder call
- public List<FingerprintSensorProperties> getSensorProperties(String opPackageName) {
+ public List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal(
+ String opPackageName) {
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
- final List<FingerprintSensorProperties> properties =
+
+ final List<FingerprintSensorPropertiesInternal> properties =
FingerprintService.this.getSensorProperties();
Slog.d(TAG, "Retrieved sensor properties for: " + opPackageName
@@ -347,7 +349,8 @@ public class FingerprintService extends SystemService {
final long ident = Binder.clearCallingIdentity();
try {
for (ServiceProvider provider : mServiceProviders) {
- for (FingerprintSensorProperties props : provider.getSensorProperties()) {
+ for (FingerprintSensorPropertiesInternal props :
+ provider.getSensorProperties()) {
if (args.length > 0 && "--proto".equals(args[0])) {
provider.dumpProto(props.sensorId, fd);
} else {
@@ -566,7 +569,7 @@ public class FingerprintService extends SystemService {
*/
@Nullable
private Pair<Integer, ServiceProvider> getSingleProvider() {
- final List<FingerprintSensorProperties> properties = getSensorProperties();
+ final List<FingerprintSensorPropertiesInternal> properties = getSensorProperties();
if (properties.size() != 1) {
return null;
}
@@ -585,8 +588,8 @@ public class FingerprintService extends SystemService {
}
@NonNull
- private List<FingerprintSensorProperties> getSensorProperties() {
- final List<FingerprintSensorProperties> properties = new ArrayList<>();
+ private List<FingerprintSensorPropertiesInternal> getSensorProperties() {
+ final List<FingerprintSensorPropertiesInternal> properties = new ArrayList<>();
for (ServiceProvider provider : mServiceProviders) {
properties.addAll(provider.getSensorProperties());
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java
index 1fcc58cd5833..d7338a02db67 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java
@@ -20,7 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.os.IBinder;
@@ -49,8 +49,8 @@ import java.util.List;
* }
*
* For operations that are supported by some providers but not others, clients are required
- * to check (e.g. via {@link FingerprintManager#getSensorProperties()}) to ensure that the code
- * path isn't taken. ServiceProviders will provide a no-op for unsupported operations to
+ * to check (e.g. via {@link FingerprintManager#getSensorPropertiesInternal()}) to ensure that the
+ * code path isn't taken. ServiceProviders will provide a no-op for unsupported operations to
* fail safely.
*/
@SuppressWarnings("deprecation")
@@ -60,7 +60,7 @@ public interface ServiceProvider {
*/
boolean containsSensor(int sensorId);
- @NonNull List<FingerprintSensorProperties> getSensorProperties();
+ @NonNull List<FingerprintSensorPropertiesInternal> getSensorProperties();
void scheduleResetLockout(int sensorId, int userId, @Nullable byte[] hardwareAuthToken);
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 30cbf40398ab..f890f57eb47b 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
@@ -33,6 +33,7 @@ import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
import android.hardware.biometrics.fingerprint.V2_2.IBiometricsFingerprintClientCallback;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.os.Handler;
@@ -91,7 +92,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
final Context mContext;
private final IActivityTaskManager mActivityTaskManager;
- @NonNull private final FingerprintSensorProperties mSensorProperties;
+ @NonNull private final FingerprintSensorPropertiesInternal mSensorProperties;
private final BiometricScheduler mScheduler;
private final Handler mHandler;
private final LockoutResetDispatcher mLockoutResetDispatcher;
@@ -347,7 +348,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
final int maxEnrollmentsPerUser = mContext.getResources()
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
- mSensorProperties = new FingerprintSensorProperties(sensorId,
+ mSensorProperties = new FingerprintSensorPropertiesInternal(sensorId,
Utils.authenticatorStrengthToPropertyStrength(strength), maxEnrollmentsPerUser,
sensorType, resetLockoutRequiresHardwareAuthToken);
}
@@ -487,8 +488,8 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
@Override
@NonNull
- public List<FingerprintSensorProperties> getSensorProperties() {
- final List<FingerprintSensorProperties> properties = new ArrayList<>();
+ public List<FingerprintSensorPropertiesInternal> getSensorProperties() {
+ final List<FingerprintSensorPropertiesInternal> properties = new ArrayList<>();
properties.add(mSensorProperties);
return properties;
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21UdfpsMock.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21UdfpsMock.java
index d68671bcc679..5dda5a8495c2 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21UdfpsMock.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21UdfpsMock.java
@@ -26,6 +26,7 @@ import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.os.Handler;
import android.os.IBinder;
@@ -124,7 +125,7 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
@NonNull private final TestableBiometricScheduler mScheduler;
@NonNull private final Handler mHandler;
- @NonNull private final FingerprintSensorProperties mSensorProperties;
+ @NonNull private final FingerprintSensorPropertiesInternal mSensorProperties;
@NonNull private final MockHalResultController mMockHalResultController;
@NonNull private final TrustManager mTrustManager;
@NonNull private final SparseBooleanArray mUserHasTrust;
@@ -418,7 +419,7 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
final boolean resetLockoutRequiresHardwareAuthToken = false;
final int maxTemplatesAllowed = mContext.getResources()
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
- mSensorProperties = new FingerprintSensorProperties(sensorId,
+ mSensorProperties = new FingerprintSensorPropertiesInternal(sensorId,
Utils.authenticatorStrengthToPropertyStrength(strength), maxTemplatesAllowed,
FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
resetLockoutRequiresHardwareAuthToken);
@@ -453,8 +454,8 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
@Override
@NonNull
- public List<FingerprintSensorProperties> getSensorProperties() {
- final List<FingerprintSensorProperties> properties = new ArrayList<>();
+ public List<FingerprintSensorPropertiesInternal> getSensorProperties() {
+ final List<FingerprintSensorPropertiesInternal> properties = new ArrayList<>();
properties.add(mSensorProperties);
return properties;
}
diff --git a/services/core/java/com/android/server/locksettings/BiometricDeferredQueue.java b/services/core/java/com/android/server/locksettings/BiometricDeferredQueue.java
index ddd56c890c2f..82b0f9c05b6b 100644
--- a/services/core/java/com/android/server/locksettings/BiometricDeferredQueue.java
+++ b/services/core/java/com/android/server/locksettings/BiometricDeferredQueue.java
@@ -20,9 +20,9 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.hardware.face.FaceManager;
-import android.hardware.face.FaceSensorProperties;
+import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.FingerprintSensorProperties;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Handler;
import android.os.IBinder;
import android.os.ServiceManager;
@@ -34,7 +34,6 @@ import com.android.internal.widget.VerifyCredentialResponse;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Set;
/**
@@ -203,9 +202,9 @@ public class BiometricDeferredQueue {
private void processPendingLockoutsForFingerprint(List<UserAuthInfo> pendingResetLockouts) {
if (mFingerprintManager != null) {
- final List<FingerprintSensorProperties> fingerprintSensorProperties =
- mFingerprintManager.getSensorProperties();
- for (FingerprintSensorProperties prop : fingerprintSensorProperties) {
+ final List<FingerprintSensorPropertiesInternal> fingerprintSensorProperties =
+ mFingerprintManager.getSensorPropertiesInternal();
+ for (FingerprintSensorPropertiesInternal prop : fingerprintSensorProperties) {
if (!prop.resetLockoutRequiresHardwareAuthToken) {
for (UserAuthInfo user : pendingResetLockouts) {
mFingerprintManager.resetLockout(prop.sensorId, user.userId,
@@ -238,16 +237,16 @@ public class BiometricDeferredQueue {
Slog.w(TAG, "mFaceGenerateChallengeCallback not null, previous operation may be"
+ " stuck");
}
- final List<FaceSensorProperties> faceSensorProperties =
- mFaceManager.getSensorProperties();
+ final List<FaceSensorPropertiesInternal> faceSensorProperties =
+ mFaceManager.getSensorPropertiesInternal();
final Set<Integer> sensorIds = new ArraySet<>();
- for (FaceSensorProperties prop : faceSensorProperties) {
+ for (FaceSensorPropertiesInternal prop : faceSensorProperties) {
sensorIds.add(prop.sensorId);
}
mFaceResetLockoutTask = new FaceResetLockoutTask(mFaceFinishCallback, mFaceManager,
mSpManager, sensorIds, pendingResetLockouts);
- for (final FaceSensorProperties prop : faceSensorProperties) {
+ for (final FaceSensorPropertiesInternal prop : faceSensorProperties) {
// Generate a challenge for each sensor. The challenge does not need to be
// per-user, since the HAT returned by gatekeeper contains userId.
mFaceManager.generateChallenge(prop.sensorId, mFaceResetLockoutTask);