Implement the state machine
Bug: 166800618
Bug: 175070939
Test: atest VtsHalBiometricsFingerprintTargetTest
Change-Id: I3a908b0f910323d643b220e560e9c2d8e4c5675a
diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h
new file mode 100644
index 0000000..9343316
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android-base/logging.h>
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+class FakeFingerprintEngine {
+ public:
+ void generateChallengeImpl(ISessionCallback* cb, int32_t /*timeoutSec*/) {
+ LOG(INFO) << "generateChallengeImpl";
+ cb->onChallengeGenerated(0 /* challenge */);
+ }
+
+ void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
+ LOG(INFO) << "revokeChallengeImpl";
+ cb->onChallengeRevoked(challenge);
+ }
+
+ void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) {
+ LOG(INFO) << "enrollImpl";
+ cb->onEnrollmentProgress(0 /* enrollmentId */, 0 /* remaining */);
+ }
+
+ void authenticateImpl(ISessionCallback* cb, int64_t /*operationId*/) {
+ LOG(INFO) << "authenticateImpl";
+ cb->onAuthenticationSucceeded(0 /* enrollmentId */, {} /* hat */);
+ }
+
+ void detectInteractionImpl(ISessionCallback* cb) {
+ LOG(INFO) << "detectInteractionImpl";
+ cb->onInteractionDetected();
+ }
+
+ void enumerateEnrollmentsImpl(ISessionCallback* cb) {
+ LOG(INFO) << "enumerateEnrollmentsImpl";
+ cb->onEnrollmentsEnumerated({} /* enrollmentIds */);
+ }
+
+ void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds) {
+ LOG(INFO) << "removeEnrollmentsImpl";
+ cb->onEnrollmentsRemoved(enrollmentIds);
+ }
+
+ void getAuthenticatorIdImpl(ISessionCallback* cb) {
+ LOG(INFO) << "getAuthenticatorIdImpl";
+ cb->onAuthenticatorIdRetrieved(0 /* authenticatorId */);
+ }
+
+ void invalidateAuthenticatorIdImpl(ISessionCallback* cb) {
+ LOG(INFO) << "invalidateAuthenticatorIdImpl";
+ cb->onAuthenticatorIdInvalidated(0 /* newAuthenticatorId */);
+ }
+
+ void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) {
+ LOG(INFO) << "resetLockoutImpl";
+ cb->onLockoutCleared();
+ }
+};
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
\ No newline at end of file