1 /*
2  * Copyright (c) 2022-2024 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_INCLUDE_IENTERPRISE_DEVICE_MGR_H
17 #define INTERFACES_INNER_API_INCLUDE_IENTERPRISE_DEVICE_MGR_H
18 #include <string>
19 
20 #include "admin_type.h"
21 #include "edm_errors.h"
22 #include "edm_ipc_interface_code.h"
23 #include "element_name.h"
24 #include "ent_info.h"
25 #include "iremote_broker.h"
26 #include "iremote_object.h"
27 #include "iremote_proxy.h"
28 #include "iremote_stub.h"
29 
30 namespace OHOS {
31 namespace EDM {
32 class IEnterpriseDeviceMgr : public IRemoteBroker {
33 public:
34     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.edm.IEnterpriseDeviceMgr");
35     virtual ErrCode EnableAdmin(AppExecFwk::ElementName &admin, EntInfo &entInfo, AdminType type, int32_t userId) = 0;
36     virtual ErrCode DisableAdmin(AppExecFwk::ElementName &admin, int32_t userId) = 0;
37     virtual ErrCode DisableSuperAdmin(const std::string &bundleName) = 0;
38     virtual ErrCode HandleDevicePolicy(uint32_t code, AppExecFwk::ElementName &admin, MessageParcel &data,
39         MessageParcel &reply, int32_t userId) = 0;
40     virtual ErrCode GetDevicePolicy(uint32_t code, MessageParcel &data, MessageParcel &reply, int32_t userId) = 0;
41     virtual ErrCode GetEnabledAdmin(AdminType type, std::vector<std::string> &enabledAdminList) = 0;
42     virtual ErrCode GetEnterpriseInfo(AppExecFwk::ElementName &admin, MessageParcel &reply) = 0;
43     virtual ErrCode SetEnterpriseInfo(AppExecFwk::ElementName &admin, EntInfo &entInfo) = 0;
44     virtual ErrCode SubscribeManagedEvent(const AppExecFwk::ElementName &admin,
45         const std::vector<uint32_t> &events) = 0;
46     virtual ErrCode UnsubscribeManagedEvent(const AppExecFwk::ElementName &admin,
47         const std::vector<uint32_t> &events) = 0;
48     virtual bool IsSuperAdmin(const std::string &bundleName) = 0;
49     virtual bool IsAdminEnabled(AppExecFwk::ElementName &admin, int32_t userId) = 0;
50     virtual ErrCode AuthorizeAdmin(const AppExecFwk::ElementName &admin, const std::string &bundleName) = 0;
51     virtual ErrCode GetSuperAdmin(MessageParcel &reply) = 0;
52     virtual ErrCode SetDelegatedPolicies(const std::string &parentAdminName, const std::string &bundleName,
53         const std::vector<std::string> &policies) = 0;
54     virtual ErrCode GetDelegatedPolicies(const std::string &parentAdminName, const std::string &bundleName,
55         std::vector<std::string> &policies) = 0;
56     virtual ErrCode GetDelegatedBundleNames(const std::string &parentAdminName, const std::string &policyName,
57         std::vector<std::string> &bundleNames) = 0;
58 };
59 } // namespace EDM
60 } // namespace OHOS
61 #endif // INTERFACES_INNER_API_INCLUDE_IENTERPRISE_DEVICE_MGR_H
62