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/face/virtualhal/BnVirtualHal.h> 20 21 #include "Face.h" 22 23 namespace aidl::android::hardware::biometrics::face { 24 using namespace virtualhal; 25 class VirtualHal : public BnVirtualHal { 26 public: VirtualHal(std::shared_ptr<Face> fp)27 VirtualHal(std::shared_ptr<Face> 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::face::NextEnrollment& in_next_enrollment) 33 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 setOperationEnrollLatency(const std::vector<int32_t>& in_latency) override; 44 ::ndk::ScopedAStatus setOperationDetectInteractionLatency( 45 const std::vector<int32_t>& in_latency) override; 46 ::ndk::ScopedAStatus setOperationDetectInteractionFails(bool in_fails) override; 47 ::ndk::ScopedAStatus setLockout(bool in_lockout) override; 48 ::ndk::ScopedAStatus setLockoutEnable(bool in_enable) override; 49 ::ndk::ScopedAStatus setLockoutTimedEnable(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 resetConfigurations() override; 54 ::ndk::ScopedAStatus setType( 55 ::aidl::android::hardware::biometrics::face::FaceSensorType in_type) override; 56 ::ndk::ScopedAStatus setSensorStrength(common::SensorStrength in_strength) override; 57 ::ndk::ScopedAStatus getFaceHal(std::shared_ptr<IFace>* _aidl_return); 58 59 private: 60 OptIntVec intVec2OptIntVec(const std::vector<int32_t>& intVec); 61 OptIntVec acquiredInfoVec2OptIntVec(const std::vector<AcquiredInfoAndVendorCode>& intVec); 62 ::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency); 63 std::shared_ptr<Face> mFp; 64 }; 65 66 } // namespace aidl::android::hardware::biometrics::face 67