blob: eb810da1e335ff6c5c4ce7b9cf3b5d40fe301141 [file] [log] [blame]
Ilya Matyukhin48ff8962021-02-22 13:13:13 -08001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
Joshua McCloskeyc8c0bad2022-05-10 05:17:44 +000018#include <aidl/android/hardware/biometrics/common/SensorStrength.h>
Joe Bolingerde94aa02021-12-09 17:00:32 -080019#include <aidl/android/hardware/biometrics/fingerprint/ISessionCallback.h>
20
Ilya Matyukhin1d524382021-07-02 20:33:51 +000021#include <random>
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080022
Joshua McCloskeyc8c0bad2022-05-10 05:17:44 +000023#include <future>
24#include <vector>
Joe Bolingerde94aa02021-12-09 17:00:32 -080025
26using namespace ::aidl::android::hardware::biometrics::common;
27
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080028namespace aidl::android::hardware::biometrics::fingerprint {
29
Joe Bolingerde94aa02021-12-09 17:00:32 -080030// A fake engine that is backed by system properties instead of hardware.
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080031class FakeFingerprintEngine {
32 public:
Ilya Matyukhin1d524382021-07-02 20:33:51 +000033 FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {}
34
Joe Bolingerde94aa02021-12-09 17:00:32 -080035 void generateChallengeImpl(ISessionCallback* cb);
36 void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge);
37 void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
38 const std::future<void>& cancel);
39 void authenticateImpl(ISessionCallback* cb, int64_t operationId,
40 const std::future<void>& cancel);
41 void detectInteractionImpl(ISessionCallback* cb, const std::future<void>& cancel);
42 void enumerateEnrollmentsImpl(ISessionCallback* cb);
43 void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds);
44 void getAuthenticatorIdImpl(ISessionCallback* cb);
45 void invalidateAuthenticatorIdImpl(ISessionCallback* cb);
46 void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/);
Ilya Matyukhin1d524382021-07-02 20:33:51 +000047
48 std::mt19937 mRandom;
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080049};
50
f8c8e4c62021-03-05 05:12:58 +000051} // namespace aidl::android::hardware::biometrics::fingerprint