• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 TIME_PERMISSION_H
16 #define TIME_PERMISSION_H
17 
18 #include <cstdint>
19 #include <mutex>
20 #include <string>
21 #include <singleton.h>
22 
23 #include "bundle_mgr_proxy.h"
24 #include "time_common.h"
25 #include "mock_permission.h"
26 #include "system_ability_definition.h"
27 #include "iservice_registry.h"
28 
29 namespace OHOS {
30 namespace MiscServices {
31 class TimePermission : public std::enable_shared_from_this<TimePermission> {
32     DECLARE_DELAYED_SINGLETON(TimePermission)
33 public:
34     bool CheckSelfPermission(const std::string permName);
35     bool CheckCallingPermission(const int32_t uid, const std::string permName);
36 
37 private:
38     sptr<AppExecFwk::IBundleMgr> GetBundleManager();
39     bool IsSystemUid(const int32_t &uid) const;
40     static sptr<AppExecFwk::IBundleMgr> bundleMgrProxy_;
41 };
42 } // namespace MiscServices
43 } // namespace OHOS
44 #endif // TIME_PERMISSION_H
45