Merge "Add ISessionCallback#onSessionClosed" into sc-dev

This commit is contained in:
Ilya Matyukhin
2021-03-23 00:07:02 +00:00
committed by Android (Google) Code Review
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;