From 25e9823f6304fa2b5c7efb6a16207326d7688078 Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Mon, 24 Jan 2022 18:56:23 +0000 Subject: [PATCH] Add update context method to face and fingerprint HAL. This is needed for changes that occur mid-operation and was lost from the previous changes when switching from the single context method to the overloaded approach. Bug: 204584403 Test: atest VtsHalBiometricsFingerprintTargetTest VtsHalBiometricsFaceTargetTest Change-Id: Ie917bce9de910a421e19130b6e518bd6fc85298e --- .../current/android/hardware/biometrics/face/ISession.aidl | 1 + .../aidl/android/hardware/biometrics/face/ISession.aidl | 6 ++++++ biometrics/face/aidl/default/Session.cpp | 4 ++++ biometrics/face/aidl/default/Session.h | 2 ++ .../android/hardware/biometrics/fingerprint/ISession.aidl | 1 + .../android/hardware/biometrics/fingerprint/ISession.aidl | 6 ++++++ biometrics/fingerprint/aidl/default/Session.cpp | 4 ++++ biometrics/fingerprint/aidl/default/include/Session.h | 2 ++ 8 files changed, 26 insertions(+) diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl index 4b51bb17cc..366553485a 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl @@ -51,4 +51,5 @@ interface ISession { 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); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); } diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl index bbe3632b6b..a92b3667fe 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl @@ -461,4 +461,10 @@ interface ISession { /* See ISession#detectInteraction() */ ICancellationSignal detectInteractionWithContext(in OperationContext context); + + /** + * This may be called while an authenticate, detect interaction, or enrollment operation is + * running when the context changes. + */ + void onContextChanged(in OperationContext context); } diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp index 9e753e5c33..984a1a99dc 100644 --- a/biometrics/face/aidl/default/Session.cpp +++ b/biometrics/face/aidl/default/Session.cpp @@ -172,4 +172,8 @@ ndk::ScopedAStatus Session::detectInteractionWithContext( return detectInteraction(out); } +ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*context*/) { + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h index 0ce9e2060e..9db17d2df9 100644 --- a/biometrics/face/aidl/default/Session.h +++ b/biometrics/face/aidl/default/Session.h @@ -82,6 +82,8 @@ class Session : public BnSession { const common::OperationContext& context, std::shared_ptr* out) override; + ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + private: std::shared_ptr cb_; std::mt19937 mRandom; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl index 4e7b3b451e..30f299d1fc 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl @@ -53,4 +53,5 @@ interface ISession { android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index ea8c6aa869..db0114514e 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -473,4 +473,10 @@ interface ISession { /** See ISession#onPointerUp(int) */ void onPointerUpWithContext(in PointerContext context); + + /** + * This may be called while an authenticate, detect interaction, or enrollment operation is + * running when the context changes. + */ + void onContextChanged(in OperationContext context); } diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index 8cbcfc77c5..452ed12b95 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -270,4 +270,8 @@ ndk::ScopedAStatus Session::onPointerUpWithContext(const PointerContext& context return onPointerUp(context.pointerId); } +ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*context*/) { + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index 584cb27b96..acd5def832 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -95,6 +95,8 @@ class Session : public BnSession { ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override; + ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + bool isClosed(); private: