1 /*
2  * Copyright (c) 2022-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 FRAMEWORK_EXTENSION_INCLUDE_IENTERPRISE_ADMIN_H
17 #define FRAMEWORK_EXTENSION_INCLUDE_IENTERPRISE_ADMIN_H
18 
19 #include <iremote_broker.h>
20 #include <string_ex.h>
21 #include "policy_struct.h"
22 
23 namespace OHOS {
24 namespace EDM {
25 class IEnterpriseAdmin : public IRemoteBroker {
26 public:
27     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.EDM.IEnterpriseAdmin");
28 
29     virtual void OnAdminEnabled() = 0;
30 
31     virtual void OnAdminDisabled() = 0;
32 
33     /**
34      * Called when a new application package has been installed on the device.
35      * @param bundleName Indicates the name of the bundle whose state has been installed.
36      */
37     virtual void OnBundleAdded(const std::string &bundleName, int32_t accountId) = 0;
38 
39     /**
40      * Called when a new application package has been Removed on the device.
41      * @param bundleName Indicates the name of the bundle whose state has been Removed.
42      */
43     virtual void OnBundleRemoved(const std::string &bundleName, int32_t accountId) = 0;
44 
45     /**
46      * Called when an application start on the device.
47      * @param bundleName Indicates the bundle name of application that has been started.
48      */
49     virtual void OnAppStart(const std::string &bundleName) = 0;
50 
51     /**
52      * Called when an application stop on the device.
53      * @param bundleName Indicates the bundle name of application that has been stopped.
54      */
55     virtual void OnAppStop(const std::string &bundleName) = 0;
56 
57     /**
58      * Called when a version need to update on the device.
59      * @param updateInfo Indicates the information of the version.
60      */
61     virtual void OnSystemUpdate(const UpdateInfo &updateInfo) = 0;
62 
63     enum {
64         COMMAND_ON_ADMIN_ENABLED = 1,
65         COMMAND_ON_ADMIN_DISABLED = 2,
66         COMMAND_ON_BUNDLE_ADDED = 3,
67         COMMAND_ON_BUNDLE_REMOVED = 4,
68         COMMAND_ON_APP_START = 5,
69         COMMAND_ON_APP_STOP = 6,
70         COMMAND_ON_SYSTEM_UPDATE = 7
71     };
72 };
73 } // namespace EDM
74 } // namespace OHOS
75 #endif // FRAMEWORK_EXTENSION_INCLUDE_IENTERPRISE_ADMIN_H