1 /* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef FACE_AUTH_SERVICE_H 16 #define FACE_AUTH_SERVICE_H 17 18 #include <cstdint> 19 #include <mutex> 20 21 #include "nocopyable.h" 22 #include "surface.h" 23 #include "system_ability.h" 24 25 #include "face_auth_stub.h" 26 27 namespace OHOS { 28 namespace UserIam { 29 namespace FaceAuth { 30 class FaceAuthService : public SystemAbility, public FaceAuthStub { 31 DECLEAR_SYSTEM_ABILITY(FaceAuthService); 32 33 public: 34 FaceAuthService(); 35 ~FaceAuthService() override = default; 36 static std::shared_ptr<FaceAuthService> GetInstance(); 37 38 int32_t SetBufferProducer(sptr<IBufferProducer> &producer) override; 39 40 protected: 41 void OnStart() override; 42 void OnStop() override; 43 44 private: 45 static std::mutex mutex_; 46 static std::shared_ptr<FaceAuthService> instance_; 47 void StartDriverManager(); 48 bool IsPermissionGranted(const std::string &permission); 49 }; 50 } // namespace FaceAuth 51 } // namespace UserIam 52 } // namespace OHOS 53 54 #endif // FACE_AUTH_SERVICE_H 55