mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge changes Ia90c6390,I5b3ed1b8 into sc-dev
* changes: IFace: fix default implementation to pass VTS IFace: fix VTS test to match the interface contract
This commit is contained in:
committed by
Android (Google) Code Review
commit
9581a89057
@@ -107,7 +107,8 @@ ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& /*enro
|
||||
ndk::ScopedAStatus Session::getFeatures() {
|
||||
LOG(INFO) << "getFeatures";
|
||||
if (cb_) {
|
||||
cb_->onFeaturesRetrieved({});
|
||||
// Must error out with UNABLE_TO_PROCESS when no faces are enrolled.
|
||||
cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
|
||||
}
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
@@ -60,9 +60,10 @@ class SessionCallback : public BnSessionCallback {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus onError(Error error, int32_t /*vendorCode*/) override {
|
||||
ndk::ScopedAStatus onError(Error error, int32_t vendorCode) override {
|
||||
auto lock = std::lock_guard<std::mutex>{mMutex};
|
||||
mError = error;
|
||||
mVendorCode = vendorCode;
|
||||
mOnErrorInvoked = true;
|
||||
mCv.notify_one();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
@@ -141,6 +142,7 @@ class SessionCallback : public BnSessionCallback {
|
||||
std::mutex mMutex;
|
||||
std::condition_variable mCv;
|
||||
Error mError = Error::UNKNOWN;
|
||||
int32_t mVendorCode = 0;
|
||||
int64_t mGeneratedChallenge = 0;
|
||||
int64_t mRevokedChallenge = 0;
|
||||
bool mOnChallengeGeneratedInvoked = false;
|
||||
@@ -218,6 +220,8 @@ TEST_P(Face, EnrollWithBadHatResultsInErrorTest) {
|
||||
// Make sure an error is returned.
|
||||
auto lock = std::unique_lock{mCb->mMutex};
|
||||
mCb->mCv.wait(lock, [this] { return mCb->mOnErrorInvoked; });
|
||||
EXPECT_EQ(mCb->mError, Error::UNABLE_TO_PROCESS);
|
||||
EXPECT_EQ(mCb->mVendorCode, 0);
|
||||
}
|
||||
|
||||
TEST_P(Face, GenerateChallengeProducesUniqueChallengesTest) {
|
||||
@@ -287,13 +291,15 @@ TEST_P(Face, RemoveEnrollmentsWorksTest) {
|
||||
mCb->mCv.wait(lock, [this] { return mCb->mOnEnrollmentsRemovedInvoked; });
|
||||
}
|
||||
|
||||
TEST_P(Face, GetFeaturesWorksTest) {
|
||||
TEST_P(Face, GetFeaturesWithoutEnrollmentsResultsInUnableToProcess) {
|
||||
// Call the method.
|
||||
ASSERT_TRUE(mSession->getFeatures().isOk());
|
||||
|
||||
// Wait for the result.
|
||||
auto lock = std::unique_lock{mCb->mMutex};
|
||||
mCb->mCv.wait(lock, [this] { return mCb->mOnFeaturesRetrievedInvoked; });
|
||||
mCb->mCv.wait(lock, [this] { return mCb->mOnErrorInvoked; });
|
||||
EXPECT_EQ(mCb->mError, Error::UNABLE_TO_PROCESS);
|
||||
EXPECT_EQ(mCb->mVendorCode, 0);
|
||||
}
|
||||
|
||||
TEST_P(Face, GetAuthenticatorIdWorksTest) {
|
||||
|
||||
Reference in New Issue
Block a user