Add HardwareInfo to CommonProps

Bug: 168541000
Test: make -j android.hardware.biometrics.common-update-api
Test: make -j
Change-Id: I2a96a46dc768b4cdb500ca8ea6bfd23c9f724866
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
index 57574b5..8dbc149 100644
--- 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
@@ -21,4 +21,5 @@
   int sensorId;
   android.hardware.biometrics.common.SensorStrength sensorStrength;
   int maxEnrollmentsPerUser;
+  android.hardware.biometrics.common.HardwareInfo[] hardwareInfo;
 }
diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl
new file mode 100644
index 0000000..b94b6b0
--- /dev/null
+++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 HardwareInfo {
+  String deviceName;
+  String hardwareVersion;
+  String firmwareVersion;
+  String serialNumber;
+}
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
index 5982397..8304c95 100644
--- a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
@@ -16,6 +16,7 @@
 
 package android.hardware.biometrics.common;
 
+import android.hardware.biometrics.common.HardwareInfo;
 import android.hardware.biometrics.common.SensorStrength;
 
 @VintfStability
@@ -40,4 +41,10 @@
      * Statically configured.
      */
     int maxEnrollmentsPerUser;
+
+    /**
+     * A list of hardware information for subsystems that pertain to this
+     * biometric sensor.
+     */
+    HardwareInfo[] hardwareInfo;
 }
\ No newline at end of file
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl
new file mode 100644
index 0000000..23f0202
--- /dev/null
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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
+parcelable HardwareInfo {
+    /**
+     * An identifier uniquely identifying a subsystem.
+     */
+    String deviceName;
+
+    /**
+     * The hardware version. For example, <vendor>/<model>/<revision>.
+     */
+    String hardwareVersion;
+
+    /**
+     * The firmware version.
+     */
+    String firmwareVersion;
+
+    /**
+     * The sensor's serial number.
+     */
+    String serialNumber;
+}
\ No newline at end of file
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 80266d2..0ca45f8 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -23,12 +23,25 @@
 const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG;
 const int kMaxEnrollmentsPerUser = 5;
 const FingerprintSensorType kSensorType = FingerprintSensorType::REAR;
+const std::string kHwDeviceName = "fingerprintSensor";
+const std::string kHardwareVersion = "vendor/model/revision";
+const std::string kFirmwareVersion = "1.01";
+const std::string kSerialNumber = "00000001";
 
 ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* return_val) {
     *return_val = std::vector<SensorProps>();
+
+    std::vector<common::HardwareInfo> hardwareInfos = std::vector<common::HardwareInfo>();
+    common::HardwareInfo sensorInfo = {kHwDeviceName,
+            kHardwareVersion,
+            kFirmwareVersion,
+            kSerialNumber
+    };
+    hardwareInfos.push_back(sensorInfo);
     common::CommonProps commonProps = {kSensorId,
             kSensorStrength,
-            kMaxEnrollmentsPerUser};
+            kMaxEnrollmentsPerUser,
+            hardwareInfos};
     SensorProps props = {commonProps,
             kSensorType,
             0 /* sensorLocationX */,