blob: 8659b793025fccc523640029b13d1c66154606a0 [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
18
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
Joe Bolingerde94aa02021-12-09 17:00:32 -080023#include "CancellationSignal.h"
24
25using namespace ::aidl::android::hardware::biometrics::common;
26
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080027namespace aidl::android::hardware::biometrics::fingerprint {
28
Joe Bolingerde94aa02021-12-09 17:00:32 -080029// A fake engine that is backed by system properties instead of hardware.
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080030class FakeFingerprintEngine {
31 public:
Ilya Matyukhin1d524382021-07-02 20:33:51 +000032 FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {}
33
Joe Bolingerde94aa02021-12-09 17:00:32 -080034 void generateChallengeImpl(ISessionCallback* cb);
35 void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge);
36 void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
37 const std::future<void>& cancel);
38 void authenticateImpl(ISessionCallback* cb, int64_t operationId,
39 const std::future<void>& cancel);
40 void detectInteractionImpl(ISessionCallback* cb, const std::future<void>& cancel);
41 void enumerateEnrollmentsImpl(ISessionCallback* cb);
42 void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds);
43 void getAuthenticatorIdImpl(ISessionCallback* cb);
44 void invalidateAuthenticatorIdImpl(ISessionCallback* cb);
45 void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/);
Ilya Matyukhin1d524382021-07-02 20:33:51 +000046
47 std::mt19937 mRandom;
Ilya Matyukhin48ff8962021-02-22 13:13:13 -080048};
49
f8c8e4c62021-03-05 05:12:58 +000050} // namespace aidl::android::hardware::biometrics::fingerprint