blob: e5f62fc1c053ece7a4a0b09ab67c7d4f8e17b3c0 [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;
Jeff Pu3bc1f062024-04-19 19:37:45 +000031 ::ndk::ScopedAStatus setNextEnrollment(
32 const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment&
33 in_next_enrollment) override;
Jeff Pudf81c962024-03-06 10:58:17 -050034 ::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override;
35 ::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override;
36 ::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override;
37 ::ndk::ScopedAStatus setOperationAuthenticateLatency(
38 const std::vector<int32_t>& in_latency) override;
39 ::ndk::ScopedAStatus setOperationAuthenticateDuration(int32_t in_duration) override;
40 ::ndk::ScopedAStatus setOperationAuthenticateError(int32_t in_error) override;
41 ::ndk::ScopedAStatus setOperationAuthenticateAcquired(
Jeff Pu3bc1f062024-04-19 19:37:45 +000042 const std::vector<AcquiredInfoAndVendorCode>& in_acquired) override;
Jeff Pudf81c962024-03-06 10:58:17 -050043 ::ndk::ScopedAStatus setOperationEnrollError(int32_t in_error) override;
44 ::ndk::ScopedAStatus setOperationEnrollLatency(const std::vector<int32_t>& in_latency) override;
45 ::ndk::ScopedAStatus setOperationDetectInteractionLatency(
46 const std::vector<int32_t>& in_latency) override;
47 ::ndk::ScopedAStatus setOperationDetectInteractionError(int32_t in_error) override;
48 ::ndk::ScopedAStatus setOperationDetectInteractionDuration(int32_t in_duration) override;
49 ::ndk::ScopedAStatus setOperationDetectInteractionAcquired(
Jeff Pu3bc1f062024-04-19 19:37:45 +000050 const std::vector<AcquiredInfoAndVendorCode>& in_acquired) override;
Jeff Pudf81c962024-03-06 10:58:17 -050051 ::ndk::ScopedAStatus setLockout(bool in_lockout) override;
52 ::ndk::ScopedAStatus setLockoutEnable(bool in_enable) override;
53 ::ndk::ScopedAStatus setLockoutTimedThreshold(int32_t in_threshold) override;
54 ::ndk::ScopedAStatus setLockoutTimedDuration(int32_t in_duration) override;
55 ::ndk::ScopedAStatus setLockoutPermanentThreshold(int32_t in_threshold) override;
Jeff Pu3bc1f062024-04-19 19:37:45 +000056 ::ndk::ScopedAStatus resetConfigurations() override;
Jeff Pudf81c962024-03-06 10:58:17 -050057 ::ndk::ScopedAStatus setType(
58 ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType in_type)
59 override;
60 ::ndk::ScopedAStatus setSensorId(int32_t in_id) override;
61 ::ndk::ScopedAStatus setSensorStrength(SensorStrength in_strength) override;
62 ::ndk::ScopedAStatus setMaxEnrollmentPerUser(int32_t in_max) override;
63 ::ndk::ScopedAStatus setSensorLocation(
64 const ::aidl::android::hardware::biometrics::fingerprint::SensorLocation& in_loc)
65 override;
66 ::ndk::ScopedAStatus setNavigationGuesture(bool in_v) override;
67 ::ndk::ScopedAStatus setDetectInteraction(bool in_v) override;
68 ::ndk::ScopedAStatus setDisplayTouch(bool in_v) override;
69 ::ndk::ScopedAStatus setControlIllumination(bool in_v) override;
70
71 private:
72 OptIntVec intVec2OptIntVec(const std::vector<int32_t>& intVec);
Jeff Pu3bc1f062024-04-19 19:37:45 +000073 OptIntVec acquiredInfoVec2OptIntVec(const std::vector<AcquiredInfoAndVendorCode>& intVec);
Jeff Pudf81c962024-03-06 10:58:17 -050074 ::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency);
75 Fingerprint* mFp;
76};
77
78} // namespace aidl::android::hardware::biometrics::fingerprint