From 8c8e4c69e9f36bec9e2b746d12ea43dff8a1cbbc Mon Sep 17 00:00:00 2001 From: f Date: Fri, 5 Mar 2021 05:12:58 +0000 Subject: [PATCH] Remove timeout from IFingerprint generateChallenge Bug: 181699471 Test: atest VtsHalBiometricsFingerprintTargetTest Change-Id: I30e3ff213e34354310b77c9cffad3c46c3256dc7 --- .../hardware/biometrics/fingerprint/ISession.aidl | 2 +- .../hardware/biometrics/fingerprint/ISession.aidl | 14 ++++++-------- biometrics/fingerprint/aidl/default/Session.cpp | 6 +++--- .../aidl/default/include/FakeFingerprintEngine.h | 4 ++-- .../fingerprint/aidl/default/include/Session.h | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) 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 cade76dcb7..87eaf96a41 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 @@ -34,7 +34,7 @@ package android.hardware.biometrics.fingerprint; @VintfStability interface ISession { - void generateChallenge(in int cookie, in int timeoutSec); + void generateChallenge(in int cookie); void revokeChallenge(in int cookie, in long challenge); android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat); android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long operationId); diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index ab7930d81b..ef2e6fc499 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -61,7 +61,7 @@ interface ISession { * to allow addition of biometric enrollments. * To secure this path, the following path is taken: * 1) Upon user requesting fingerprint enroll, the framework requests - * IFingerprint#generateChallenge + * ISession#generateChallenge * 2) Framework sends the challenge to the credential subsystem, and upon credential * confirmation, a HAT is created, containing the challenge in the "challenge" field. * 3) Framework sends the HAT to the HAL, e.g. ISession#enroll. @@ -69,10 +69,9 @@ interface ISession { * 5) Implementation now has confidence that the user entered their credential to allow * biometric enrollment. * - * Note that the interface allows multiple in-flight challenges. For example, invoking - * generateChallenge(0, 0, timeoutSec, cb) twice does not invalidate the first challenge. The - * challenge is invalidated only when: - * 1) The provided timeout expires, or + * Note that this interface allows multiple in-flight challenges. Invoking generateChallenge + * twice does not invalidate the first challenge. The challenge is invalidated only when: + * 1) Its lifespan exceeds the HAL's internal challenge timeout * 2) IFingerprint#revokeChallenge is invoked * * For example, the following is a possible table of valid challenges: @@ -86,9 +85,8 @@ interface ISession { * ---------------------------------------------- * * @param cookie A unique number identifying this operation - * @param timeoutSec Duration for which the challenge is valid for */ - void generateChallenge(in int cookie, in int timeoutSec); + void generateChallenge(in int cookie); /** * revokeChallenge: @@ -117,7 +115,7 @@ interface ISession { * * Before capturing fingerprint data, the implementation must first verify the authenticity and * integrity of the provided HardwareAuthToken. In addition, it must check that the challenge - * within the provided HardwareAuthToken is valid. See IFingerprint#generateChallenge. If any of + * within the provided HardwareAuthToken is valid. See ISession#generateChallenge. If any of * the above checks fail, the framework must be notified via ISessionCallback#onError and the * HAL must notify the framework when it returns to the idle state. See * Error::UNABLE_TO_PROCESS. diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index f6a03143a0..9e6ac77a2f 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -60,13 +60,13 @@ bool Session::isClosed() { return mCurrentState == SessionState::CLOSED; } -ndk::ScopedAStatus Session::generateChallenge(int32_t cookie, int32_t timeoutSec) { +ndk::ScopedAStatus Session::generateChallenge(int32_t cookie) { LOG(INFO) << "generateChallenge"; scheduleStateOrCrash(SessionState::GENERATING_CHALLENGE); - mWorker->schedule(Callable::from([this, cookie, timeoutSec] { + mWorker->schedule(Callable::from([this, cookie] { enterStateOrCrash(cookie, SessionState::GENERATING_CHALLENGE); - mEngine->generateChallengeImpl(mCb.get(), timeoutSec); + mEngine->generateChallengeImpl(mCb.get()); enterIdling(cookie); })); diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index 934331638e..42e1aa5357 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -22,7 +22,7 @@ namespace aidl::android::hardware::biometrics::fingerprint { class FakeFingerprintEngine { public: - void generateChallengeImpl(ISessionCallback* cb, int32_t /*timeoutSec*/) { + void generateChallengeImpl(ISessionCallback* cb) { LOG(INFO) << "generateChallengeImpl"; cb->onChallengeGenerated(0 /* challenge */); } @@ -73,4 +73,4 @@ class FakeFingerprintEngine { } }; -} // namespace aidl::android::hardware::biometrics::fingerprint \ No newline at end of file +} // 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 adda8310f4..d2f0c19777 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -32,7 +32,7 @@ class Session : public BnSession { Session(int sensorId, int userId, std::shared_ptr cb, FakeFingerprintEngine* engine, WorkerThread* worker); - ndk::ScopedAStatus generateChallenge(int32_t cookie, int32_t timeoutSec) override; + ndk::ScopedAStatus generateChallenge(int32_t cookie) override; ndk::ScopedAStatus revokeChallenge(int32_t cookie, int64_t challenge) override;