diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp new file mode 100644 index 0000000000..f7462e6f51 --- /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/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl new file mode 100644 index 0000000000..57574b5385 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL interface (or parcelable). Do not try to +// edit this file. It looks like you are doing that because you have modified +// an AIDL interface in a backward-incompatible way, e.g., deleting a function +// from an interface or a field from a parcelable and it broke the build. That +// breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// 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.common; +@VintfStability +parcelable CommonProps { + int sensorId; + android.hardware.biometrics.common.SensorStrength sensorStrength; + int maxEnrollmentsPerUser; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl new file mode 100644 index 0000000000..eaff85d2f9 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL interface (or parcelable). Do not try to +// edit this file. It looks like you are doing that because you have modified +// an AIDL interface in a backward-incompatible way, e.g., deleting a function +// from an interface or a field from a parcelable and it broke the build. That +// breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// 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.common; +@Backing(type="byte") @VintfStability +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 0000000000..5982397fbf --- /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 0000000000..7460279728 --- /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 e6baa8a8b9..6bf20386e1 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -5,6 +5,7 @@ aidl_interface { "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 2aaf94fc01..14bfece745 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 c30e35d96b..04a8f8671f 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 589e737f93..765a2ed664 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 @@ package android.hardware.biometrics.fingerprint; @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 bbb1ecb622..5355c5eea9 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 6f9e3a0628..6eb62377b0 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* /*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* return_val) { + *return_val = std::vector(); + 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 058a008370..4690d73d80 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 hal = ndk::SharedRefBase::make(); diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index 50653a15a2..ce25a1936d 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -58,6 +58,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { "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",