1 /* 2 * Copyright (c) 2022 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 "bundle_mgr_interface.h" 22 #include "nocopyable.h" 23 #include "surface.h" 24 #include "system_ability.h" 25 26 #include "face_auth_stub.h" 27 28 namespace OHOS { 29 namespace UserIam { 30 namespace FaceAuth { 31 class FaceAuthService : public SystemAbility, public FaceAuthStub { 32 DECLEAR_SYSTEM_ABILITY(FaceAuthService); 33 34 public: 35 FaceAuthService(); 36 ~FaceAuthService() override = default; 37 static std::shared_ptr<FaceAuthService> GetInstance(); 38 39 void OnStart() override; 40 void OnStop() override; 41 int32_t SetBufferProducer(sptr<IBufferProducer> &producer) override; 42 private: 43 static std::mutex mutex_; 44 static std::shared_ptr<FaceAuthService> instance_; 45 static sptr<AppExecFwk::IBundleMgr> bundleMgr_; 46 void StartDriverManager(); 47 bool IsPermissionGranted(const std::string &permission); 48 sptr<AppExecFwk::IBundleMgr> GetBundleMgr(); 49 }; 50 } // namespace FaceAuth 51 } // namespace UserIam 52 } // namespace OHOS 53 54 #endif // FACE_AUTH_SERVICE_H 55