diff options
| author | Kevin Chyn <kchyn@google.com> | 2020-09-23 21:33:35 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-09-23 21:33:35 +0000 |
| commit | 7545d23747f040adadc0db1d372b941c346f3c28 (patch) | |
| tree | 7bc19799af6103547f58b934b20a9057a92637fa /core/java | |
| parent | 0e2927e75b401dd09ec9ac17c798f34ea2db4379 (diff) | |
| parent | c1ef4186c8937860320c3d224631ee27de17519a (diff) | |
Merge "Match Framework and AIDL SensorProps"
Diffstat (limited to 'core/java')
5 files changed, 112 insertions, 20 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index f86eb9082e01..8d0cc68056f8 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -103,6 +103,7 @@ public class BiometricManager { @IntDef(flag = true, value = { BIOMETRIC_STRONG, BIOMETRIC_WEAK, + BIOMETRIC_CONVENIENCE, DEVICE_CREDENTIAL, }) @interface Types {} diff --git a/core/java/android/hardware/biometrics/SensorProperties.java b/core/java/android/hardware/biometrics/SensorProperties.java new file mode 100644 index 000000000000..0f33ac4f0568 --- /dev/null +++ b/core/java/android/hardware/biometrics/SensorProperties.java @@ -0,0 +1,82 @@ +/* + * 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 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. + * @hide + */ +public class SensorProperties implements Parcelable { + + public static final int STRENGTH_CONVENIENCE = 0; + public static final int STRENGTH_WEAK = 1; + public static final int STRENGTH_STRONG = 2; + + @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; + + protected SensorProperties(int sensorId, @Strength int sensorStrength, + int maxEnrollmentsPerUser) { + this.sensorId = sensorId; + this.sensorStrength = sensorStrength; + this.maxEnrollmentsPerUser = maxEnrollmentsPerUser; + } + + 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; + } + + @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/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl index 437feb13b845..e744c840c298 100644 --- a/core/java/android/hardware/face/IFaceService.aidl +++ b/core/java/android/hardware/face/IFaceService.aidl @@ -110,5 +110,5 @@ interface IFaceService { String opPackageName); // Give FaceService its ID. See AuthService.java - void initializeConfiguration(int sensorId); + void initializeConfiguration(int sensorId, int strength); } diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java b/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java index 2fd006809046..718141a4845a 100644 --- a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java +++ b/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java @@ -17,6 +17,7 @@ package android.hardware.fingerprint; import android.annotation.IntDef; +import android.hardware.biometrics.SensorProperties; import android.hardware.face.FaceSensorProperties; import android.os.Parcel; import android.os.Parcelable; @@ -28,45 +29,44 @@ import java.lang.annotation.RetentionPolicy; * Container for fingerprint sensor properties. * @hide */ -public class FingerprintSensorProperties implements Parcelable { +public class FingerprintSensorProperties extends SensorProperties { public static final int TYPE_UNKNOWN = 0; public static final int TYPE_REAR = 1; - public static final int TYPE_UDFPS = 2; - public static final int TYPE_POWER_BUTTON = 3; + public static final int TYPE_UDFPS_ULTRASONIC = 2; + public static final int TYPE_UDFPS_OPTICAL = 3; + public static final int TYPE_POWER_BUTTON = 4; + public static final int TYPE_HOME_BUTTON = 5; - @IntDef({ - TYPE_UNKNOWN, + @IntDef({TYPE_UNKNOWN, TYPE_REAR, - TYPE_UDFPS, - TYPE_POWER_BUTTON}) + TYPE_UDFPS_ULTRASONIC, + TYPE_UDFPS_OPTICAL, + TYPE_POWER_BUTTON, + TYPE_HOME_BUTTON}) @Retention(RetentionPolicy.SOURCE) public @interface SensorType {} - public final int sensorId; 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; - // Maximum number of enrollments a user/profile can have. - public final int maxTemplatesAllowed; /** * Initializes SensorProperties with specified values */ - public FingerprintSensorProperties(int sensorId, @SensorType int sensorType, - boolean resetLockoutRequiresHardwareAuthToken, int maxTemplatesAllowed) { - this.sensorId = sensorId; + public FingerprintSensorProperties(int sensorId, @Strength int strength, + int maxEnrollmentsPerUser, @SensorType int sensorType, + boolean resetLockoutRequiresHardwareAuthToken) { + super(sensorId, strength, maxEnrollmentsPerUser); this.sensorType = sensorType; this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken; - this.maxTemplatesAllowed = maxTemplatesAllowed; } protected FingerprintSensorProperties(Parcel in) { - sensorId = in.readInt(); + super(in); sensorType = in.readInt(); resetLockoutRequiresHardwareAuthToken = in.readBoolean(); - maxTemplatesAllowed = in.readInt(); } public static final Creator<FingerprintSensorProperties> CREATOR = @@ -89,9 +89,18 @@ public class FingerprintSensorProperties implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(sensorId); + super.writeToParcel(dest, flags); dest.writeInt(sensorType); dest.writeBoolean(resetLockoutRequiresHardwareAuthToken); - dest.writeInt(maxTemplatesAllowed); + } + + 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 0fae15648e15..cc2b520b3152 100644 --- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl +++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl @@ -118,7 +118,7 @@ interface IFingerprintService { void removeClientActiveCallback(IFingerprintClientActiveCallback callback); // Give FingerprintService its ID. See AuthService.java - void initializeConfiguration(int sensorId); + void initializeConfiguration(int sensorId, int strength); // Notifies about a finger touching the sensor area. void onFingerDown(int x, int y, float minor, float major); |
