Update common and face AIDL for session logging.

Bug: 204585936
Bug: 204584403
Test: atest VtsHalBiometricsFaceTargetTest
Change-Id: Icba064c5c48f808327323ab64b7b63f68737a2f8
This commit is contained in:
Joe Bolinger
2022-01-12 16:27:03 -08:00
parent 13cb0fb235
commit 7bd42e1b14
9 changed files with 65 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ aidl_interface {
imports: [
"android.hardware.biometrics.common",
"android.hardware.common-V2",
"android.hardware.keymaster",
"android.hardware.keymaster-V3",
],
stability: "vintf",
backend: {

View File

@@ -48,4 +48,7 @@ interface ISession {
void invalidateAuthenticatorId();
void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat);
void close();
android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context);
android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface, in android.hardware.biometrics.common.OperationContext context);
android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context);
}

View File

@@ -17,6 +17,7 @@
package android.hardware.biometrics.face;
import android.hardware.biometrics.common.ICancellationSignal;
import android.hardware.biometrics.common.OperationContext;
import android.hardware.biometrics.face.EnrollmentStageConfig;
import android.hardware.biometrics.face.EnrollmentType;
import android.hardware.biometrics.face.Feature;
@@ -441,4 +442,23 @@ interface ISession {
* - ISessionCallback#onSessionClosed
*/
void close();
/**
* These are alternative methods for some operations to allow the HAL to make optional
* optimizations during execution.
*
* HALs may ignore the additional context and treat all *WithContext methods the same as
* the original methods.
*/
/* See ISession#authenticateWithContext(long) */
ICancellationSignal authenticateWithContext(in long operationId, in OperationContext context);
/* See ISession#enroll(HardwareAuthToken, EnrollmentType, Feature[], NativeHandle) */
ICancellationSignal enrollWithContext(in HardwareAuthToken hat, in EnrollmentType type,
in Feature[] features, in @nullable NativeHandle previewSurface,
in OperationContext context);
/* See ISession#detectInteraction() */
ICancellationSignal detectInteractionWithContext(in OperationContext context);
}

View File

@@ -16,8 +16,8 @@ cc_binary {
shared_libs: [
"libbase",
"libbinder_ndk",
"android.hardware.biometrics.face-V1-ndk",
"android.hardware.biometrics.common-V1-ndk",
"android.hardware.biometrics.face-V2-ndk",
"android.hardware.biometrics.common-V2-ndk",
],
srcs: [
"main.cpp",

View File

@@ -151,4 +151,25 @@ ndk::ScopedAStatus Session::close() {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::authenticateWithContext(
int64_t operationId, const common::OperationContext& /*context*/,
std::shared_ptr<common::ICancellationSignal>* out) {
return authenticate(operationId, out);
}
ndk::ScopedAStatus Session::enrollWithContext(const keymaster::HardwareAuthToken& hat,
EnrollmentType enrollmentType,
const std::vector<Feature>& features,
const std::optional<NativeHandle>& previewSurface,
const common::OperationContext& /*context*/,
std::shared_ptr<common::ICancellationSignal>* out) {
return enroll(hat, enrollmentType, features, previewSurface, out);
}
ndk::ScopedAStatus Session::detectInteractionWithContext(
const common::OperationContext& /*context*/,
std::shared_ptr<common::ICancellationSignal>* out) {
return detectInteraction(out);
}
} // namespace aidl::android::hardware::biometrics::face

View File

@@ -68,6 +68,20 @@ class Session : public BnSession {
ndk::ScopedAStatus close() override;
ndk::ScopedAStatus authenticateWithContext(
int64_t operationId, const common::OperationContext& context,
std::shared_ptr<common::ICancellationSignal>* out) override;
ndk::ScopedAStatus enrollWithContext(
const keymaster::HardwareAuthToken& hat, EnrollmentType enrollmentType,
const std::vector<Feature>& features, const std::optional<NativeHandle>& previewSurface,
const common::OperationContext& context,
std::shared_ptr<common::ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteractionWithContext(
const common::OperationContext& context,
std::shared_ptr<common::ICancellationSignal>* out) override;
private:
std::shared_ptr<ISessionCallback> cb_;
std::mt19937 mRandom;

View File

@@ -1,6 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.biometrics.face</name>
<version>2</version>
<fqname>IFace/default</fqname>
</hal>
</manifest>

View File

@@ -15,8 +15,8 @@ cc_test {
],
srcs: ["VtsHalBiometricsFaceTargetTest.cpp"],
static_libs: [
"android.hardware.biometrics.common-V1-ndk",
"android.hardware.biometrics.face-V1-ndk",
"android.hardware.biometrics.common-V2-ndk",
"android.hardware.biometrics.face-V2-ndk",
"android.hardware.common-V2-ndk",
"android.hardware.keymaster-V3-ndk",
],

View File

@@ -110,6 +110,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.biometrics.face</name>
<version>2</version>
<interface>
<name>IFace</name>
<instance>default</instance>