IFingerprint: update default implementation am: 1d52438592
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15192111 Change-Id: I9072ef742649bb4258071c43f1fda7cc6d75db0d
This commit is contained in:
commit
f3c53e9c55
1 changed files with 14 additions and 2 deletions
|
@ -17,14 +17,19 @@
|
|||
#pragma once
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <random>
|
||||
|
||||
namespace aidl::android::hardware::biometrics::fingerprint {
|
||||
|
||||
class FakeFingerprintEngine {
|
||||
public:
|
||||
FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {}
|
||||
|
||||
void generateChallengeImpl(ISessionCallback* cb) {
|
||||
LOG(INFO) << "generateChallengeImpl";
|
||||
cb->onChallengeGenerated(0 /* challenge */);
|
||||
std::uniform_int_distribution<int64_t> dist;
|
||||
auto challenge = dist(mRandom);
|
||||
cb->onChallengeGenerated(challenge);
|
||||
}
|
||||
|
||||
void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
|
||||
|
@ -32,8 +37,13 @@ class FakeFingerprintEngine {
|
|||
cb->onChallengeRevoked(challenge);
|
||||
}
|
||||
|
||||
void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) {
|
||||
void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat) {
|
||||
LOG(INFO) << "enrollImpl";
|
||||
// Do proper HAT verification in the real implementation.
|
||||
if (hat.mac.empty()) {
|
||||
cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
|
||||
return;
|
||||
}
|
||||
cb->onEnrollmentProgress(0 /* enrollmentId */, 0 /* remaining */);
|
||||
}
|
||||
|
||||
|
@ -71,6 +81,8 @@ class FakeFingerprintEngine {
|
|||
LOG(INFO) << "resetLockoutImpl";
|
||||
cb->onLockoutCleared();
|
||||
}
|
||||
|
||||
std::mt19937 mRandom;
|
||||
};
|
||||
|
||||
} // namespace aidl::android::hardware::biometrics::fingerprint
|
||||
|
|
Loading…
Reference in a new issue