Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c81d417 authored by Ilya Matyukhin's avatar Ilya Matyukhin Committed by Automerger Merge Worker
Browse files

Merge changes Ia90c6390,I5b3ed1b8 into sc-dev am: 9581a890

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15350855

Change-Id: I5156384cde731a7dc8f6e7cfb230bb8188fd1368
parents 06d32389 9581a890
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();
}
+9 −3
Original line number Diff line number Diff line
@@ -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) {