Merge "HAT validity check should be performed early" into udc-qpr-dev am: bdf9c891cf

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

Change-Id: Ia7d3d4fc534595c26c234d22896f4dc6cb0480b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeff Pu
2023-07-28 13:55:58 +00:00
committed by Automerger Merge Worker

View File

@@ -52,6 +52,14 @@ void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb,
const keymaster::HardwareAuthToken& hat,
const std::future<void>& cancel) {
BEGIN_OP(0);
// Do proper HAT verification in the real implementation.
if (hat.mac.empty()) {
LOG(ERROR) << "Fail: hat";
cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
return;
}
updateContext(WorkMode::kEnroll, cb, const_cast<std::future<void>&>(cancel), 0, hat);
}
@@ -112,17 +120,10 @@ void FakeFingerprintEngine::fingerDownAction() {
}
bool FakeFingerprintEngine::onEnrollFingerDown(ISessionCallback* cb,
const keymaster::HardwareAuthToken& hat,
const keymaster::HardwareAuthToken&,
const std::future<void>& cancel) {
BEGIN_OP(getLatency(FingerprintHalProperties::operation_enroll_latency()));
// Do proper HAT verification in the real implementation.
if (hat.mac.empty()) {
LOG(ERROR) << "Fail: hat";
cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
return true;
}
// Force error-out
auto err = FingerprintHalProperties::operation_enroll_error().value_or(0);
if (err != 0) {