1 /*
2  * Copyright (c) 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 
16 #ifndef INTERFACES_INNER_API_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_PROXY_H
17 #define INTERFACES_INNER_API_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_PROXY_H
18 
19 #include "clipboard_policy.h"
20 #include "enterprise_device_mgr_proxy.h"
21 #include "password_policy.h"
22 
23 namespace OHOS {
24 namespace EDM {
25 struct DeviceEncryptionStatus {
26     bool isEncrypted = false;
27 };
28 
29 class SecurityManagerProxy {
30 public:
31     static std::shared_ptr<SecurityManagerProxy> GetSecurityManagerProxy();
32     int32_t GetSecurityPatchTag(const AppExecFwk::ElementName &admin, std::string &info);
33     int32_t GetDeviceEncryptionStatus(const AppExecFwk::ElementName &admin,
34         DeviceEncryptionStatus &deviceEncryptionStatus);
35     int32_t SetPasswordPolicy(const AppExecFwk::ElementName &admin, const PasswordPolicy &policy);
36     int32_t GetPasswordPolicy(const AppExecFwk::ElementName &admin, PasswordPolicy &policy);
37     int32_t GetPasswordPolicy(PasswordPolicy &policy);
38     int32_t GetRootCheckStatus(const AppExecFwk::ElementName &admin, std::string &info);
39     int32_t SetAppClipboardPolicy(const AppExecFwk::ElementName &admin, const int32_t tokenId,
40         const int32_t policy);
41     int32_t GetAppClipboardPolicy(const AppExecFwk::ElementName &admin, const int32_t tokenId,
42         std::string &policy);
43 
44 private:
45     int32_t GetPasswordPolicy(const AppExecFwk::ElementName *admin, PasswordPolicy &policy);
46     static std::shared_ptr<SecurityManagerProxy> instance_;
47     static std::mutex mutexLock_;
48 };
49 } // namespace EDM
50 } // namespace OHOS
51 #endif // INTERFACES_INNER_API_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_PROXY_H