Add ISessionCallback#onSessionClosed

Bug: 181984005
Test: m android.hardware.biometrics.fingerprint-update-api
Test: m android.hardware.biometrics.face-update-api
Test: atest VtsHalBiometricsFingerprintTargetTest
Change-Id: I766c3ae0dc9916c376da6432a5545af581dda819
This commit is contained in:
Ilya Matyukhin 2021-03-22 13:25:15 -07:00
parent 977c1dcfe9
commit cbbfa93a17
7 changed files with 20 additions and 2 deletions

View file

@ -53,4 +53,5 @@ interface ISessionCallback {
void onEnrollmentsRemoved(in int[] enrollmentIds);
void onAuthenticatorIdRetrieved(in long authenticatorId);
void onAuthenticatorIdInvalidated(in long newAuthenticatorId);
void onSessionClosed();
}

View file

@ -227,4 +227,10 @@ interface ISessionCallback {
* current set of enrollments.
*/
void onAuthenticatorIdInvalidated(in long newAuthenticatorId);
/**
* This method notifes the client that this session has closed.
* The client must not make any more calls to this session.
*/
void onSessionClosed();
}

View file

@ -120,6 +120,8 @@ class SessionCallback : public BnSessionCallback {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); }
private:
std::promise<SessionCallbackInvocation> invocation_promise_;
};

View file

@ -50,4 +50,5 @@ interface ISessionCallback {
void onEnrollmentsRemoved(in int[] enrollmentIds);
void onAuthenticatorIdRetrieved(in long authenticatorId);
void onAuthenticatorIdInvalidated(in long newAuthenticatorId);
void onSessionClosed();
}

View file

@ -200,4 +200,10 @@ interface ISessionCallback {
* current set of enrollments.
*/
void onAuthenticatorIdInvalidated(in long newAuthenticatorId);
/**
* This method notifes the client that this session has closed.
* The client must not make any more calls to this session.
*/
void onSessionClosed();
}

View file

@ -219,11 +219,11 @@ ndk::ScopedAStatus Session::resetLockout(int32_t cookie, const keymaster::Hardwa
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::close(int32_t cookie) {
ndk::ScopedAStatus Session::close(int32_t /*cookie*/) {
LOG(INFO) << "close";
CHECK(mCurrentState == SessionState::IDLING) << "Can't close a non-idling session. Crashing.";
mCurrentState = SessionState::CLOSED;
mCb->onStateChanged(cookie, mCurrentState);
mCb->onSessionClosed();
return ndk::ScopedAStatus::ok();
}

View file

@ -119,6 +119,8 @@ class SessionCallback : public BnSessionCallback {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); }
private:
bool mIsPromiseValid;
std::vector<Invocation> mInvocations;