1 /* 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 23 namespace aidl::android::hardware::biometrics::fingerprint { 24 25 class VirtualHal : public BnVirtualHal { 26 public: VirtualHal(Fingerprint * fp)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 setNextEnrollment( 32 const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment& 33 in_next_enrollment) override; 34 ::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( 42 const std::vector<AcquiredInfoAndVendorCode>& in_acquired) override; 43 ::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( 50 const std::vector<AcquiredInfoAndVendorCode>& in_acquired) override; 51 ::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; 56 ::ndk::ScopedAStatus resetConfigurations() override; 57 ::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); 73 OptIntVec acquiredInfoVec2OptIntVec(const std::vector<AcquiredInfoAndVendorCode>& intVec); 74 ::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency); 75 Fingerprint* mFp; 76 }; 77 78 } // namespace aidl::android::hardware::biometrics::fingerprint 79