• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     /**
64      * Called when an account added on the device.
65      * @param accountId Indicates the accountId that has been added.
66      */
67     virtual void OnAccountAdded(const int32_t accountId) = 0;
68 
69     /**
70      * Called when an account switched on the device.
71      * @param accountId Indicates the accountId that has been switched.
72      */
73     virtual void OnAccountSwitched(const int32_t accountId) = 0;
74 
75     /**
76      * Called when an account removed on the device.
77      * @param accountId Indicates the accountId that has been removed.
78      */
79     virtual void OnAccountRemoved(const int32_t accountId) = 0;
80 
81     /**
82      * Called when a device is entering kiosk mode.
83      * @param bundleName  The authorized bundleName using kiosk mode.
84      */
85     virtual void OnKioskModeEntering(const std::string &bundleName, int32_t accountId) = 0;
86 
87     /**
88      * Called when a device is exiting kiosk mode.
89      */
90     virtual void OnKioskModeExiting(const std::string &bundleName, int32_t accountId) = 0;
91 
92     enum {
93         COMMAND_ON_ADMIN_ENABLED = 1,
94         COMMAND_ON_ADMIN_DISABLED = 2,
95         COMMAND_ON_BUNDLE_ADDED = 3,
96         COMMAND_ON_BUNDLE_REMOVED = 4,
97         COMMAND_ON_APP_START = 5,
98         COMMAND_ON_APP_STOP = 6,
99         COMMAND_ON_SYSTEM_UPDATE = 7,
100         COMMAND_ON_ACCOUNT_ADDED = 8,
101         COMMAND_ON_ACCOUNT_SWITCHED = 9,
102         COMMAND_ON_ACCOUNT_REMOVED = 10,
103         COMMAND_ON_KIOSK_MODE_ENTERING = 11,
104         COMMAND_ON_KIOSK_MODE_EXITING = 12
105     };
106 };
107 } // namespace EDM
108 } // namespace OHOS
109 #endif // FRAMEWORK_EXTENSION_INCLUDE_IENTERPRISE_ADMIN_H