IFace: update default implementation

Bug: 170651283
Test: atest VtsHalBiometricsFaceTargetTest
Change-Id: I6f8e6ec12e597034264e2b1383bc7325b0f697b7
This commit is contained in:
Ilya Matyukhin 2021-07-03 00:04:43 +00:00
parent 53bd75df19
commit 60406beac6
2 changed files with 17 additions and 2 deletions

View file

@ -34,12 +34,15 @@ class CancellationSignal : public common::BnCancellationSignal {
}
};
Session::Session(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {}
Session::Session(std::shared_ptr<ISessionCallback> cb)
: cb_(std::move(cb)), mRandom(std::mt19937::default_seed) {}
ndk::ScopedAStatus Session::generateChallenge() {
LOG(INFO) << "generateChallenge";
if (cb_) {
cb_->onChallengeGenerated(0);
std::uniform_int_distribution<int64_t> dist;
auto challenge = dist(mRandom);
cb_->onChallengeGenerated(challenge);
}
return ndk::ScopedAStatus::ok();
}
@ -63,6 +66,9 @@ ndk::ScopedAStatus Session::enroll(
const std::vector<Feature>& /*features*/, const NativeHandle& /*previewSurface*/,
std::shared_ptr<biometrics::common::ICancellationSignal>* /*return_val*/) {
LOG(INFO) << "enroll";
if (cb_) {
cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
}
return ndk::ScopedAStatus::ok();
}
@ -100,6 +106,9 @@ ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& /*enro
ndk::ScopedAStatus Session::getFeatures() {
LOG(INFO) << "getFeatures";
if (cb_) {
cb_->onFeaturesRetrieved({});
}
return ndk::ScopedAStatus::ok();
}
@ -119,6 +128,9 @@ ndk::ScopedAStatus Session::getAuthenticatorId() {
ndk::ScopedAStatus Session::invalidateAuthenticatorId() {
LOG(INFO) << "invalidateAuthenticatorId";
if (cb_) {
cb_->onAuthenticatorIdInvalidated(0);
}
return ndk::ScopedAStatus::ok();
}

View file

@ -16,6 +16,8 @@
#pragma once
#include <random>
#include <aidl/android/hardware/biometrics/face/BnSession.h>
#include <aidl/android/hardware/biometrics/face/ISessionCallback.h>
@ -68,6 +70,7 @@ class Session : public BnSession {
private:
std::shared_ptr<ISessionCallback> cb_;
std::mt19937 mRandom;
};
} // namespace aidl::android::hardware::biometrics::face