Add android.hardware.biometrics.common
Bug: 168541000
Test: make -j56 android.hardware.biometrics.common-update-api
Test: make -j56 android.hardware.biometrics.fingerprint-update-api
Test: make -j56 android.hardware.biometrics.fingerprint-service.example
Change-Id: Icaa1c2a0363a7fa446747ef89b5e50ca44dcd42e
diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp
new file mode 100644
index 0000000..f7462e6
--- /dev/null
+++ b/biometrics/common/aidl/Android.bp
@@ -0,0 +1,16 @@
+aidl_interface {
+ name: "android.hardware.biometrics.common",
+ vendor_available: true,
+ srcs: [
+ "android/hardware/biometrics/common/*.aidl",
+ ],
+ stability: "vintf",
+ backend: {
+ java: {
+ platform_apis: true,
+ },
+ cpp: {
+ enabled: false,
+ },
+ }
+}
\ No newline at end of file
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl
similarity index 81%
copy from biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl
copy to biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl
index 2aaf94f..57574b5 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl
+++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl
@@ -15,13 +15,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.biometrics.fingerprint;
-@Backing(type="byte") @VintfStability
-enum SensorType {
- UNKNOWN = 0,
- REAR = 1,
- UNDER_DISPLAY_ULTRASONIC = 2,
- UNDER_DISPLAY_OPTICAL = 3,
- POWER_BUTTON = 4,
- HOME_BUTTON = 5,
+package android.hardware.biometrics.common;
+@VintfStability
+parcelable CommonProps {
+ int sensorId;
+ android.hardware.biometrics.common.SensorStrength sensorStrength;
+ int maxEnrollmentsPerUser;
}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl
similarity index 84%
copy from biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl
copy to biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl
index 2aaf94f..eaff85d 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl
+++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl
@@ -15,13 +15,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.biometrics.fingerprint;
+package android.hardware.biometrics.common;
@Backing(type="byte") @VintfStability
-enum SensorType {
- UNKNOWN = 0,
- REAR = 1,
- UNDER_DISPLAY_ULTRASONIC = 2,
- UNDER_DISPLAY_OPTICAL = 3,
- POWER_BUTTON = 4,
- HOME_BUTTON = 5,
+enum SensorStrength {
+ CONVENIENCE = 0,
+ WEAK = 1,
+ STRONG = 2,
}
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
new file mode 100644
index 0000000..5982397
--- /dev/null
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
@@ -0,0 +1,43 @@
+/*
+ * 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.common;
+
+import android.hardware.biometrics.common.SensorStrength;
+
+@VintfStability
+parcelable CommonProps {
+ /**
+ * A statically configured unique ID that identifies a single biometric
+ * sensor. IDs must start at zero and increment by one for each unique
+ * sensor. Note that ID allocations are shared between all biometric
+ * modalities (e.g. fingerprint, face, iris), and a single ID must never
+ * be claimed by more than a single sensor.
+ */
+ int sensorId;
+
+ /**
+ * A statically configured strength for this sensor. See the SensorStrength
+ * interface for more information.
+ */
+ SensorStrength sensorStrength;
+
+ /**
+ * The maximum number of enrollments that a single user can have.
+ * Statically configured.
+ */
+ int maxEnrollmentsPerUser;
+}
\ No newline at end of file
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl
new file mode 100644
index 0000000..7460279
--- /dev/null
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl
@@ -0,0 +1,44 @@
+/*
+ * 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.common;
+
+@VintfStability
+@Backing(type="byte")
+enum SensorStrength {
+ /**
+ * 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 ia the
+ * public API surface.
+ */
+ CONVENIENCE,
+
+ /**
+ * A sensor that meets the requirements for Class 2 biometrics as defined
+ * in the CDD. Corresponds to BiometricManager.Authenticators.BIOMETRIC_WEAK.
+ */
+ WEAK,
+
+ /**
+ * 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/verification of
+ * HardwareAuthToken(s).
+ */
+ STRONG,
+}
\ No newline at end of file
diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp
index e6baa8a..6bf2038 100644
--- a/biometrics/fingerprint/aidl/Android.bp
+++ b/biometrics/fingerprint/aidl/Android.bp
@@ -5,6 +5,7 @@
"android/hardware/biometrics/fingerprint/**/*.aidl",
],
imports: [
+ "android.hardware.biometrics.common",
"android.hardware.keymaster",
],
stability: "vintf",
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl
similarity index 97%
rename from biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl
rename to biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl
index 2aaf94f..14bfece 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorType.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl
@@ -17,7 +17,7 @@
package android.hardware.biometrics.fingerprint;
@Backing(type="byte") @VintfStability
-enum SensorType {
+enum FingerprintSensorType {
UNKNOWN = 0,
REAR = 1,
UNDER_DISPLAY_ULTRASONIC = 2,
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl
index c30e35d..04a8f86 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl
@@ -18,7 +18,6 @@
package android.hardware.biometrics.fingerprint;
@VintfStability
parcelable SensorProps {
- int sensorId;
- android.hardware.biometrics.fingerprint.SensorType sensorType;
- boolean resetLockoutRequiresHardwareAuthToken;
+ android.hardware.biometrics.common.CommonProps commonProps;
+ android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType;
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorType.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl
similarity index 96%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorType.aidl
rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl
index 589e737..765a2ed 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorType.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl
@@ -18,7 +18,7 @@
@VintfStability
@Backing(type="byte")
-enum SensorType {
+enum FingerprintSensorType {
UNKNOWN,
REAR,
UNDER_DISPLAY_ULTRASONIC,
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl
index bbb1ecb6..5355c5e 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl
@@ -16,14 +16,20 @@
package android.hardware.biometrics.fingerprint;
-import android.hardware.biometrics.fingerprint.SensorType;
+import android.hardware.biometrics.common.CommonProps;
+import android.hardware.biometrics.fingerprint.FingerprintSensorType;
@VintfStability
parcelable SensorProps {
- int sensorId;
+ /**
+ * Statically configured properties that apply to this fingerprint sensor.
+ */
+ CommonProps commonProps;
- SensorType sensorType;
-
- boolean resetLockoutRequiresHardwareAuthToken;
+ /**
+ * A statically configured sensor type representing this fingerprint
+ * sensor.
+ */
+ FingerprintSensorType sensorType;
}
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 6f9e3a0..6eb6237 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -19,7 +19,19 @@
namespace aidl::android::hardware::biometrics::fingerprint {
-ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* /*return_val*/) {
+const int kSensorId = 0;
+const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG;
+const int kMaxEnrollmentsPerUser = 5;
+const FingerprintSensorType kSensorType = FingerprintSensorType::REAR;
+
+ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* return_val) {
+ *return_val = std::vector<SensorProps>();
+ common::CommonProps commonProps = {kSensorId,
+ kSensorStrength,
+ kMaxEnrollmentsPerUser};
+ SensorProps props = {commonProps,
+ kSensorType};
+ return_val->push_back(props);
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp
index 058a008..4690d73 100644
--- a/biometrics/fingerprint/aidl/default/main.cpp
+++ b/biometrics/fingerprint/aidl/default/main.cpp
@@ -23,6 +23,7 @@
using aidl::android::hardware::biometrics::fingerprint::Fingerprint;
int main() {
+ LOG(INFO) << "Fingerprint HAL started";
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index 50653a1..ce25a19 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -58,6 +58,7 @@
"android.hardware.gnss.visibility_control@1.0",
"android.hardware.radio.config@1.2",
// AIDL
+ "android.hardware.biometrics.common",
"android.hardware.common",
"android.hardware.graphics.common",
"android.hardware.keymaster",