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
This commit is contained in:
Kevin Chyn
2020-09-15 13:01:40 -07:00
parent 4fd960f90a
commit 7d3fdf5ef6
13 changed files with 182 additions and 11 deletions

View File

@@ -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,
},
}
}

View File

@@ -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;
}

View File

@@ -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,
}

View File

@@ -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;
}

View File

@@ -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,
}

View File

@@ -5,6 +5,7 @@ aidl_interface {
"android/hardware/biometrics/fingerprint/**/*.aidl",
],
imports: [
"android.hardware.biometrics.common",
"android.hardware.keymaster",
],
stability: "vintf",

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -18,7 +18,7 @@ package android.hardware.biometrics.fingerprint;
@VintfStability
@Backing(type="byte")
enum SensorType {
enum FingerprintSensorType {
UNKNOWN,
REAR,
UNDER_DISPLAY_ULTRASONIC,

View File

@@ -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;
}

View File

@@ -19,7 +19,19 @@
namespace aidl::android::hardware::biometrics::fingerprint {
ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* /*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<SensorProps>* return_val) {
*return_val = std::vector<SensorProps>();
common::CommonProps commonProps = {kSensorId,
kSensorStrength,
kMaxEnrollmentsPerUser};
SensorProps props = {commonProps,
kSensorType};
return_val->push_back(props);
return ndk::ScopedAStatus::ok();
}

View File

@@ -23,6 +23,7 @@
using aidl::android::hardware::biometrics::fingerprint::Fingerprint;
int main() {
LOG(INFO) << "Fingerprint HAL started";
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();

View File

@@ -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",