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/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 0000000..57574b5
--- /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 0000000..eaff85d
--- /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 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