blob: 6cc4b669fb69473970ade8e1a41983a5c912e495 [file] [log] [blame]
Jeff Pudf81c962024-03-06 10:58:17 -05001/*
2 * Copyright (C) 2024 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/BnVirtualHal.h>
20
21#include "Fingerprint.h"
22
23namespace aidl::android::hardware::biometrics::fingerprint {
24
25class VirtualHal : public BnVirtualHal {
26 public:
27 VirtualHal(Fingerprint* fp) : mFp(fp) {}
28
29 ::ndk::ScopedAStatus setEnrollments(const std::vector<int32_t>& in_id) override;
30 ::ndk::ScopedAStatus setEnrollmentHit(int32_t in_hit_id) override;
31 ::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override;
32 ::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override;
33 ::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override;
34 ::ndk::ScopedAStatus setOperationAuthenticateLatency(
35 const std::vector<int32_t>& in_latency) override;
36 ::ndk::ScopedAStatus setOperationAuthenticateDuration(int32_t in_duration) override;
37 ::ndk::ScopedAStatus setOperationAuthenticateError(int32_t in_error) override;
38 ::ndk::ScopedAStatus setOperationAuthenticateAcquired(
39 const std::vector<int32_t>& in_acquired) override;
40 ::ndk::ScopedAStatus setOperationEnrollError(int32_t in_error) override;
41 ::ndk::ScopedAStatus setOperationEnrollLatency(const std::vector<int32_t>& in_latency) override;
42 ::ndk::ScopedAStatus setOperationDetectInteractionLatency(
43 const std::vector<int32_t>& in_latency) override;
44 ::ndk::ScopedAStatus setOperationDetectInteractionError(int32_t in_error) override;
45 ::ndk::ScopedAStatus setOperationDetectInteractionDuration(int32_t in_duration) override;
46 ::ndk::ScopedAStatus setOperationDetectInteractionAcquired(
47 const std::vector<int32_t>& in_acquired) override;
48 ::ndk::ScopedAStatus setLockout(bool in_lockout) override;
49 ::ndk::ScopedAStatus setLockoutEnable(bool in_enable) override;
50 ::ndk::ScopedAStatus setLockoutTimedThreshold(int32_t in_threshold) override;
51 ::ndk::ScopedAStatus setLockoutTimedDuration(int32_t in_duration) override;
52 ::ndk::ScopedAStatus setLockoutPermanentThreshold(int32_t in_threshold) override;
53 ::ndk::ScopedAStatus setType(
54 ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType in_type)
55 override;
56 ::ndk::ScopedAStatus setSensorId(int32_t in_id) override;
57 ::ndk::ScopedAStatus setSensorStrength(SensorStrength in_strength) override;
58 ::ndk::ScopedAStatus setMaxEnrollmentPerUser(int32_t in_max) override;
59 ::ndk::ScopedAStatus setSensorLocation(
60 const ::aidl::android::hardware::biometrics::fingerprint::SensorLocation& in_loc)
61 override;
62 ::ndk::ScopedAStatus setNavigationGuesture(bool in_v) override;
63 ::ndk::ScopedAStatus setDetectInteraction(bool in_v) override;
64 ::ndk::ScopedAStatus setDisplayTouch(bool in_v) override;
65 ::ndk::ScopedAStatus setControlIllumination(bool in_v) override;
66
67 private:
68 OptIntVec intVec2OptIntVec(const std::vector<int32_t>& intVec);
69 ::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency);
70 Fingerprint* mFp;
71};
72
73} // namespace aidl::android::hardware::biometrics::fingerprint