Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48618556 authored by Haining Chen's avatar Haining Chen
Browse files

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
parent 8fd9f0ab
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -37,6 +37,5 @@ parcelable CommonProps {
  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;
}
+4 −2
Original line number Diff line number Diff line
@@ -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;
}
+3 −12
Original line number Diff line number Diff line
@@ -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 @@ parcelable CommonProps {
    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;
}
+17 −2
Original line number Diff line number Diff line
@@ -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;
}
+18 −8
Original line number Diff line number Diff line
@@ -24,23 +24,33 @@ const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG;
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);
Loading