Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 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 | |
| 19 | #include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h> |
| 20 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 21 | #include "FakeFingerprintEngine.h" |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 22 | #include "FakeFingerprintEngineRear.h" |
| 23 | #include "FakeFingerprintEngineSide.h" |
| 24 | #include "FakeFingerprintEngineUdfps.h" |
| 25 | |
Jeff Pu | 6ccd956 | 2024-02-21 10:46:35 -0500 | [diff] [blame^] | 26 | #include "FingerprintConfig.h" |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 27 | #include "Session.h" |
Joshua McCloskey | c8c0bad | 2022-05-10 05:17:44 +0000 | [diff] [blame] | 28 | #include "thread/WorkerThread.h" |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 29 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 30 | namespace aidl::android::hardware::biometrics::fingerprint { |
| 31 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 32 | class Fingerprint : public BnFingerprint { |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 33 | public: |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame] | 34 | Fingerprint(); |
| 35 | |
| 36 | ndk::ScopedAStatus getSensorProps(std::vector<SensorProps>* out) override; |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 37 | |
| 38 | ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId, |
| 39 | const std::shared_ptr<ISessionCallback>& cb, |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame] | 40 | std::shared_ptr<ISession>* out) override; |
Jeff Pu | 5265318 | 2022-10-12 16:27:23 -0400 | [diff] [blame] | 41 | binder_status_t dump(int fd, const char** args, uint32_t numArgs); |
| 42 | binder_status_t handleShellCommand(int in, int out, int err, const char** argv, uint32_t argc); |
Ilya Matyukhin | 71005c5 | 2021-02-17 12:44:14 -0800 | [diff] [blame] | 43 | |
Jeff Pu | 6ccd956 | 2024-02-21 10:46:35 -0500 | [diff] [blame^] | 44 | static FingerprintConfig& cfg() { |
| 45 | static FingerprintConfig* cfg = nullptr; |
| 46 | if (cfg == nullptr) { |
| 47 | cfg = new FingerprintConfig(); |
| 48 | cfg->init(); |
| 49 | } |
| 50 | return *cfg; |
| 51 | } |
| 52 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 53 | private: |
Jeff Pu | 5265318 | 2022-10-12 16:27:23 -0400 | [diff] [blame] | 54 | void resetConfigToDefault(); |
| 55 | void onHelp(int); |
Jeff Pu | def5b04 | 2023-05-25 14:28:16 -0400 | [diff] [blame] | 56 | void onSimFingerDown(); |
Jeff Pu | 6ccd956 | 2024-02-21 10:46:35 -0500 | [diff] [blame^] | 57 | void clearConfigSysprop(); |
Jeff Pu | 5265318 | 2022-10-12 16:27:23 -0400 | [diff] [blame] | 58 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 59 | std::unique_ptr<FakeFingerprintEngine> mEngine; |
| 60 | WorkerThread mWorker; |
Ilya Matyukhin | c605e0b | 2021-02-25 16:04:34 -0800 | [diff] [blame] | 61 | std::shared_ptr<Session> mSession; |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 62 | FingerprintSensorType mSensorType; |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | } // namespace aidl::android::hardware::biometrics::fingerprint |