• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef PIN_AUTH_SERVICE_H
17 #define PIN_AUTH_SERVICE_H
18 
19 #include <mutex>
20 #include <map>
21 
22 #include "nocopyable.h"
23 #include "system_ability.h"
24 #include "system_ability_definition.h"
25 
26 #include "pin_auth_stub.h"
27 
28 namespace OHOS {
29 namespace UserIam {
30 namespace PinAuth {
31 class PinAuthService : public SystemAbility, public PinAuthStub {
32 public:
33     DECLEAR_SYSTEM_ABILITY(PinAuthService);
34     PinAuthService();
35     static std::shared_ptr<PinAuthService> GetInstance();
36 
37     // SystemAbility
38     void OnStart() override;
39     void OnStop() override;
40     bool RegisterInputer(const sptr<InputerGetData> &inputer) override;
41     void UnRegisterInputer() override;
42     bool CheckPermission(const std::string &permission);
43 
44 private:
45     static std::mutex mutex_;
46     static std::shared_ptr<PinAuthService> instance_;
47     inline uint32_t GetTokenId();
48     void StartDriverManager();
49 };
50 } // namespace PinAuth
51 } // namespace UserIam
52 } // namespace OHOS
53 
54 #endif // PIN_AUTH_SERVICE_H
55