• 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 COMMON_NATIVE_INCLUDE_EDM_ERRORS_H
17 #define COMMON_NATIVE_INCLUDE_EDM_ERRORS_H
18 
19 #include "errors.h"
20 
21 namespace OHOS {
22 namespace EDM {
23 enum {
24     EDM_MODULE_EDMSERVICE = 0x00,
25     EDM_MODULE_ADMINMGR = 0x02,
26     EDM_MODULE_POLICYMGR = 0x03,
27     EDM_MODULE_PLUGINMGR = 0x04,
28     // Reserved 0x04 ~ 0x0f for new modules, Event related modules start from 0x10
29 };
30 
31 namespace EdmReturnErrCode {
32     constexpr uint32_t PARAM_ERROR = 401;
33     constexpr uint32_t PERMISSION_DENIED = 201;
34     constexpr uint32_t SYSTEM_API_DENIED = 202;
35     constexpr uint32_t INTERFACE_UNSUPPORTED = 801;
36 
37     constexpr uint32_t ADMIN_INACTIVE = 9200001;
38     constexpr uint32_t ADMIN_EDM_PERMISSION_DENIED = 9200002;
39     constexpr uint32_t COMPONENT_INVALID = 9200003;
40     constexpr uint32_t ENABLE_ADMIN_FAILED = 9200004;
41     constexpr uint32_t DISABLE_ADMIN_FAILED = 9200005;
42     constexpr uint32_t UID_INVALID = 9200006;
43     constexpr uint32_t SYSTEM_ABNORMALLY = 9200007;
44     constexpr uint32_t MANAGED_EVENTS_INVALID = 9200008;
45     constexpr uint32_t AUTHORIZE_PERMISSION_FAILED = 9200009;
46 
47     constexpr uint32_t MANAGED_CERTIFICATE_FAILED = 9201001;
48     constexpr uint32_t APPLICATION_INSTALL_FAILED = 9201002;
49 };
50 
51 // Error code for SERVICE: 0x2000000,value:33554432
52 constexpr ErrCode EDM_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_CUSTOMIZATION, EDM_MODULE_EDMSERVICE);
53 enum {
54     ERR_EDM_SERVICE_NOT_READY = EDM_SERVICE_ERR_OFFSET + 1,
55     ERR_EDM_PARAM_ERROR,
56     ERR_EDM_PERMISSION_ERROR,
57     ERR_EDM_ADD_ADMIN_FAILED,
58     ERR_EDM_DEL_ADMIN_FAILED,
59     ERR_EDM_GET_PERMISSION_REQ_FAILED,
60     ERR_EDM_GET_PLUGIN_MGR_FAILED,
61     ERR_EDM_GET_ADMIN_MGR_FAILED,
62     ERR_EDM_HANDLE_POLICY_FAILED,
63     ERR_EDM_GET_POLICY_FAILED,
64     ERR_EDM_BMS_ERROR,
65     ERR_EDM_DEL_SUPER_ADMIN_FAILED,
66     ERR_EDM_GET_ENTINFO_FAILED,
67     ERR_EDM_SET_ENTINFO_FAILED,
68     ERR_EDM_DUMP_FAILED,
69     ERR_EDM_SA_LOAD_FAILED,
70     ERR_GET_STORAGE_RDB_FAILED,
71     ERR_SAVE_AUTHORIZED_ADMIN_FAILED,
72 };
73 
74 // Error code for ADMINMGR: 0x2020000,value:33685504
75 constexpr ErrCode EDM_ADMINMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_CUSTOMIZATION, EDM_MODULE_ADMINMGR);
76 enum {
77     // the install error code from 0x0001 ~ 0x0060.
78     ERR_EDM_UNKNOWN_PERMISSION = EDM_ADMINMGR_ERR_OFFSET + 0x0001,
79     ERR_EDM_EMPTY_PERMISSIONS = EDM_ADMINMGR_ERR_OFFSET + 0x0002,
80     ERR_EDM_DENY_ADMIN = EDM_ADMINMGR_ERR_OFFSET + 0x0003,
81     ERR_EDM_DENY_PERMISSION = EDM_ADMINMGR_ERR_OFFSET + 0x0004,
82     ERR_EDM_UNKNOWN_ADMIN = EDM_ADMINMGR_ERR_OFFSET + 0x0005,
83     ERR_EDM_SUPER_ADMIN_NOT_FOUND = EDM_ADMINMGR_ERR_OFFSET + 0x0006,
84 };
85 
86 // Error code for POLICYMGR: 0x2030000,value:33751040
87 constexpr ErrCode EDM_POLICYMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_CUSTOMIZATION, EDM_MODULE_POLICYMGR);
88 enum {
89     ERR_EDM_POLICY_OPEN_JSON_FAILED = EDM_POLICYMGR_ERR_OFFSET + 1,
90     ERR_EDM_POLICY_LOAD_JSON_FAILED = EDM_POLICYMGR_ERR_OFFSET + 2,
91     ERR_EDM_POLICY_PARSE_JSON_FAILED = EDM_POLICYMGR_ERR_OFFSET + 3,
92     ERR_EDM_POLICY_NOT_FIND = EDM_POLICYMGR_ERR_OFFSET + 4,
93     ERR_EDM_POLICY_SET_FAILED = EDM_POLICYMGR_ERR_OFFSET + 5,
94     ERR_EDM_POLICY_NOT_FOUND = EDM_POLICYMGR_ERR_OFFSET + 6,
95     ERR_EDM_POLICY_DEL_FAILED = EDM_POLICYMGR_ERR_OFFSET + 7,
96 };
97 
98 // Error code for POLICYMGR: 0x2040000,value:33816576
99 constexpr ErrCode EDM_PLUGINMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_CUSTOMIZATION, EDM_MODULE_PLUGINMGR);
100 enum {
101     ERR_EDM_OPERATE_JSON = EDM_PLUGINMGR_ERR_OFFSET + 1,
102     ERR_EDM_WRITE_JSON = EDM_PLUGINMGR_ERR_OFFSET + 2,
103     ERR_EDM_READ_PARCEL = EDM_PLUGINMGR_ERR_OFFSET + 3,
104     ERR_EDM_OPERATE_PARCEL = EDM_PLUGINMGR_ERR_OFFSET + 4,
105     ERR_EDM_NOT_EXIST_POLICY = EDM_PLUGINMGR_ERR_OFFSET + 5,
106     ERR_EDM_NOT_EXIST_FUNC = EDM_PLUGINMGR_ERR_OFFSET + 6,
107 };
108 
109 #define RETURN_IF_FAILED(errcode) if (FAILED(errcode)) { return errcode; }
110 } // namespace EDM
111 } // namespace OHOS
112 
113 #endif // COMMON_NATIVE_INCLUDE_EDM_ERRORS_H
114