Rename HardwareInfo to ComponentInfo for the flexibility and
extensibility to support new biometric sensor properties
Bug: 156024031
Test: m -j android.hardware.biometrics.common-update-api
Test: m -j android.hardware.biometrics.face-service.example
Test: m -j android.hardware.biometrics.fingerprint-service.example
Change-Id: Iede6fe7eefbdde2320b495e467430b3e6269b5b6
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 4b4e7df..d4433c5 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
@@ -37,6 +37,5 @@
int sensorId;
android.hardware.biometrics.common.SensorStrength sensorStrength = android.hardware.biometrics.common.SensorStrength.CONVENIENCE;
int maxEnrollmentsPerUser;
- android.hardware.biometrics.common.HardwareInfo[] hardwareInfo;
- String softwareInfo;
+ android.hardware.biometrics.common.ComponentInfo[] componentInfo;
}
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/ComponentInfo.aidl
similarity index 94%
rename from biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl
rename to biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ComponentInfo.aidl
index c5288fd..ad11dda 100644
--- 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/ComponentInfo.aidl
@@ -33,8 +33,10 @@
package android.hardware.biometrics.common;
@VintfStability
-parcelable HardwareInfo {
- String deviceName;
+parcelable ComponentInfo {
+ String componentId;
String hardwareVersion;
+ String firmwareVersion;
String serialNumber;
+ String softwareVersion;
}
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
index 7c3d511..2f5af5d 100644
--- a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl
@@ -16,7 +16,7 @@
package android.hardware.biometrics.common;
-import android.hardware.biometrics.common.HardwareInfo;
+import android.hardware.biometrics.common.ComponentInfo;
import android.hardware.biometrics.common.SensorStrength;
@VintfStability
@@ -41,16 +41,7 @@
int maxEnrollmentsPerUser;
/**
- * A list of hardware information for subsystems that pertain to this biometric sensor.
+ * A list of component information for subsystems that pertain to this biometric sensor.
*/
- HardwareInfo[] hardwareInfo;
-
- /**
- * Software information for subsystems that pertain to this biometric sensor.
- * This may include information for the matching algorithm, the PAD (Presentation Attack
- * Detection) algorithm, and any other algorithm(s) used by this biometric sensor.
- * For example, <algorithm_1_info>;<algorithm_2_info>;<algorithm_3_info>.
- * The format of each algorithm's info can be <vendor>/<algorithm>/<version>.
- */
- String softwareInfo;
+ ComponentInfo[] componentInfo;
}
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl
similarity index 62%
rename from biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl
rename to biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl
index ce9e354..b268eef 100644
--- a/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl
@@ -17,19 +17,34 @@
package android.hardware.biometrics.common;
@VintfStability
-parcelable HardwareInfo {
+parcelable ComponentInfo {
/**
* An identifier uniquely identifying a subsystem.
+ * It must not be an empty string.
*/
- String deviceName;
+ String componentId;
/**
* The hardware version. For example, <vendor>/<model>/<revision>.
+ * If there's no hardware version for this component, it must be empty.
*/
String hardwareVersion;
/**
+ * The firmware version.
+ * If there's no firmware version for this component, it must be empty.
+ */
+ String firmwareVersion;
+
+ /**
* The sensor's serial number.
+ * If there's no serial number for this component, it must be empty.
*/
String serialNumber;
+
+ /**
+ * The software version. For example, <vendor>/<version>/<revision>.
+ * If there's no software version for this component, it must be empty.
+ */
+ String softwareVersion;
}
diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp
index a4520de..aca3e13 100644
--- a/biometrics/face/aidl/default/Face.cpp
+++ b/biometrics/face/aidl/default/Face.cpp
@@ -24,23 +24,33 @@
const int kMaxEnrollmentsPerUser = 5;
const FaceSensorType kSensorType = FaceSensorType::RGB;
const bool kHalControlsPreview = true;
-const std::string kHwDeviceName = "faceSensor";
+const std::string kHwComponentId = "faceSensor";
const std::string kHardwareVersion = "vendor/model/revision";
+const std::string kFirmwareVersion = "1.01";
const std::string kSerialNumber = "00000001";
-const std::string kSoftwareVersion = "vendor1/algorithm1/version;vendor2/algorithm2/version";
+const std::string kSwComponentId = "matchingAlgorithm";
+const std::string kSoftwareVersion = "vendor/version/revision";
ndk::ScopedAStatus Face::getSensorProps(std::vector<SensorProps>* return_val) {
- common::HardwareInfo hardware_info;
- hardware_info.deviceName = kHwDeviceName;
- hardware_info.hardwareVersion = kHardwareVersion;
- hardware_info.serialNumber = kSerialNumber;
+ common::ComponentInfo hw_component_info;
+ hw_component_info.componentId = kHwComponentId;
+ hw_component_info.hardwareVersion = kHardwareVersion;
+ hw_component_info.firmwareVersion = kFirmwareVersion;
+ hw_component_info.serialNumber = kSerialNumber;
+ hw_component_info.softwareVersion = "";
+
+ common::ComponentInfo sw_component_info;
+ sw_component_info.componentId = kSwComponentId;
+ sw_component_info.hardwareVersion = "";
+ sw_component_info.firmwareVersion = "";
+ sw_component_info.serialNumber = "";
+ sw_component_info.softwareVersion = kSoftwareVersion;
common::CommonProps commonProps;
commonProps.sensorId = kSensorId;
commonProps.sensorStrength = kSensorStrength;
commonProps.maxEnrollmentsPerUser = kMaxEnrollmentsPerUser;
- commonProps.hardwareInfo = {std::move(hardware_info)};
- commonProps.softwareInfo = kSoftwareVersion;
+ commonProps.componentInfo = {std::move(hw_component_info), std::move(sw_component_info)};
SensorProps props;
props.commonProps = std::move(commonProps);
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 79f48fe..fbfa52f 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -26,10 +26,12 @@
constexpr int MAX_ENROLLMENTS_PER_USER = 5;
constexpr FingerprintSensorType SENSOR_TYPE = FingerprintSensorType::REAR;
constexpr bool SUPPORTS_NAVIGATION_GESTURES = true;
-constexpr char HW_DEVICE_NAME[] = "fingerprintSensor";
+constexpr char HW_COMPONENT_ID[] = "fingerprintSensor";
constexpr char HW_VERSION[] = "vendor/model/revision";
+constexpr char FW_VERSION[] = "1.01";
constexpr char SERIAL_NUMBER[] = "00000001";
-constexpr char SW_VERSION[] = "vendor1/algorithm1/version;vendor2/algorithm2/version";
+constexpr char SW_COMPONENT_ID[] = "matchingAlgorithm";
+constexpr char SW_VERSION[] = "vendor/version/revision";
} // namespace
@@ -37,10 +39,13 @@
: mEngine(std::make_unique<FakeFingerprintEngine>()), mWorker(MAX_WORKER_QUEUE_SIZE) {}
ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) {
- std::vector<common::HardwareInfo> hardwareInfos = {{HW_DEVICE_NAME, HW_VERSION, SERIAL_NUMBER}};
+ std::vector<common::ComponentInfo> componentInfo = {
+ {HW_COMPONENT_ID, HW_VERSION, FW_VERSION, SERIAL_NUMBER, "" /* softwareVersion */},
+ {SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */,
+ "" /* serialNumber */, SW_VERSION}};
common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER,
- hardwareInfos, SW_VERSION};
+ componentInfo};
SensorLocation sensorLocation = {0 /* displayId */, 0 /* sensorLocationX */,
0 /* sensorLocationY */, 0 /* sensorRadius */};