• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 namespace OHOS {
24 namespace AppExecFwk {
25 namespace Constants {
26 constexpr const char* TYPE_ONLY_MATCH_WILDCARD = "reserved/wildcard";
27 const std::string EMPTY_STRING = "";
28 constexpr const char* INSTALL_FILE_SUFFIX = ".hap";
29 constexpr const char* INSTALL_SHARED_FILE_SUFFIX = ".hsp";
30 constexpr const char* QUICK_FIX_FILE_SUFFIX = ".hqf";
31 const std::string PATH_SEPARATOR = "/";
32 constexpr const char* FILE_UNDERLINE = "_";
33 const char FILE_SEPARATOR_CHAR = '/';
34 constexpr const char* CURRENT_DEVICE_ID = "PHONE-001";
35 constexpr const char* HAP_COPY_PATH = "/data/service/el1/public/bms/bundle_manager_service";
36 constexpr const char* CACHE_DIR = "cache";
37 constexpr const char* TMP_SUFFIX = "_tmp";
38 constexpr const char* ASSETS_DIR = "assets";
39 constexpr const char* RESOURCES_INDEX = "resources.index";
40 constexpr const char* BUNDLE_CODE_DIR = "/data/app/el1/bundle/public";
41 constexpr const char* BUNDLE_BASE_CODE_DIR = "/data/app/el1/bundle";
42 constexpr const char* BUNDLE_APP_DATA_BASE_DIR = "/data/app/";
43 constexpr const char* BASE = "/base/";
44 constexpr const char* DATABASE = "/database/";
45 constexpr const char* HAPS = "/haps/";
46 constexpr const char* BUNDLE_MANAGER_SERVICE_PATH = "/data/service/el1/public/bms/bundle_manager_service";
47 constexpr const char* SANDBOX_DATA_PATH = "/data/storage/el2/base";
48 constexpr const char* REAL_DATA_PATH = "/data/app/el2";
49 constexpr const char* DATA_GROUP_PATH = "/group/";
50 constexpr const char* STREAM_INSTALL_PATH = "stream_install";
51 constexpr const char* SECURITY_STREAM_INSTALL_PATH = "security_stream_install";
52 constexpr const char* QUICK_FIX_PATH = "quick_fix";
53 constexpr const char* SECURITY_QUICK_FIX_PATH = "security_quick_fix";
54 constexpr const char* BUNDLE_ASAN_LOG_DIR = "/data/local/app-logs";
55 const std::vector<std::string> BUNDLE_EL = {"el1", "el2"};
56 constexpr int START_USERID = 100;
57 constexpr int DEFAULT_USERID = 0;
58 constexpr int INVALID_USERID = -1;
59 constexpr int UNSPECIFIED_USERID = -2;
60 constexpr int ALL_USERID = -3;
61 constexpr int ANY_USERID = -4;
62 constexpr int NOT_EXIST_USERID = -5;
63 constexpr int PATH_MAX_SIZE = 256;
64 constexpr int SIGNATURE_MATCHED = 0;
65 constexpr int SIGNATURE_NOT_MATCHED = 1;
66 constexpr int SIGNATURE_UNKNOWN_BUNDLE = 2;
67 constexpr int PERMISSION_GRANTED = 0;
68 constexpr int PERMISSION_NOT_GRANTED = -1;
69 constexpr int DEFAULT_STREAM_FD = -1;
70 constexpr int DUMP_INDENT = 4;
71 constexpr unsigned int INSTALLD_UMASK = 0000;
72 constexpr int32_t INVALID_API_VERSION = -1;
73 constexpr int32_t API_VERSION_EIGHT = 8;
74 constexpr int32_t API_VERSION_NINE = 9;
75 constexpr int32_t ALL_VERSIONCODE = -1;
76 constexpr int32_t INVALID_UDID = -1;
77 constexpr int32_t DEFAULT_INSTALLERID = -1;
78 
79 // native so
80 constexpr const char* ABI_DEFAULT = "default";
81 constexpr const char* ABI_SEPARATOR = ",";
82 constexpr const char* MODULE_NAME_SEPARATOR = ",";
83 constexpr const char* ARM_EABI = "armeabi";
84 constexpr const char* ARM_EABI_V7A = "armeabi-v7a";
85 constexpr const char* ARM64_V8A = "arm64-v8a";
86 constexpr const char* X86 = "x86";
87 constexpr const char* X86_64 = "x86_64";
88 constexpr const char* ARM64 = "arm64";
89 const std::string LIBS = "libs/";
90 const std::string AN = "an/";
91 const std::string AP = "ap/";
92 constexpr const char* LIBS_ARM_EABI_V7A = "libs/armeabi-v7a/";
93 constexpr const char* ARM = "arm";
94 const std::map<std::string, std::string> ABI_MAP = {
95     {ARM_EABI, "arm"},
96     {ARM_EABI_V7A, "arm"},
97     {ARM64_V8A, "arm64"},
98     {X86, "x86"},
99     {X86_64, "x86_64"},
100 };
101 constexpr const char* SO_SUFFIX = ".so";
102 constexpr const char* AN_SUFFIX = ".an";
103 constexpr const char* AI_SUFFIX = ".ai";
104 constexpr const char* AP_SUFFIX = ".ap";
105 constexpr const char* SYSTEM_LIB64 = "/system/lib64";
106 constexpr const char* DIFF_SUFFIX = ".diff";
107 constexpr const char* PATCH_PATH = "patch_";
108 constexpr const char* HOT_RELOAD_PATH = "hotreload_";
109 
110 // uid and gid
111 constexpr int32_t INVALID_UID = -1;
112 constexpr int32_t INVALID_GID = -1;
113 constexpr int32_t INVALID_BUNDLEID = -1;
114 constexpr int32_t INVALID_ACCESS_TOKEN_ID = -1;
115 constexpr int32_t ROOT_UID = 0;
116 constexpr int32_t BMS_UID = 1000;
117 constexpr int32_t SHELL_UID = 2000;
118 constexpr int32_t BACKU_HOME_GID = 1089;
119 constexpr int32_t ACCOUNT_UID = 3058;
120 constexpr int32_t FOUNDATION_UID = 5523;
121 constexpr int32_t BMS_GID = 1000;
122 constexpr int32_t BASE_SYS_UID = 2100;
123 constexpr int32_t MAX_SYS_UID = 2899;
124 constexpr int32_t BASE_SYS_VEN_UID = 5000;
125 constexpr int32_t MAX_SYS_VEN_UID = 5999;
126 constexpr int32_t BASE_APP_UID = 10000;
127 constexpr int32_t BASE_USER_RANGE = 200000;
128 constexpr int32_t DATA_GROUP_UID_OFFSET = 100000;
129 constexpr int32_t MAX_APP_UID = 65535;
130 constexpr int32_t U_VALUE = 100000;
131 constexpr int32_t DATABASE_DIR_GID = 3012;
132 constexpr int32_t DFS_GID = 1009;
133 constexpr const char* PROFILE_KEY_UID_SIZE = "size";
134 constexpr const char* PROFILE_KEY_UID_AND_GID = "uid_and_gid";
135 constexpr const char* FOUNDATION_PROCESS_NAME = "foundation";
136 // for render process
137 constexpr int32_t START_UID_FOR_RENDER_PROCESS = 1000000;
138 constexpr int32_t END_UID_FOR_RENDER_PROCESS = 1099999;
139 
140 // permissions
141 constexpr const char* PERMISSION_INSTALL_BUNDLE = "ohos.permission.INSTALL_BUNDLE";
142 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_BUNDLE";
143 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_NORMAL_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE";
144 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_MDM_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE";
145 constexpr const char* PERMISSION_GET_BUNDLE_INFO = "ohos.permission.GET_BUNDLE_INFO";
146 constexpr const char* PERMISSION_GET_BUNDLE_INFO_PRIVILEGED = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
147 constexpr const char* PERMISSION_CHANGE_ABILITY_ENABLED_STATE = "ohos.permission.CHANGE_ABILITY_ENABLED_STATE";
148 constexpr const char* PERMISSION_REMOVECACHEFILE = "ohos.permission.REMOVE_CACHE_FILES";
149 constexpr const char* PERMISSION_MANAGE_DISPOSED_APP_STATUS = "ohos.permission.MANAGE_DISPOSED_APP_STATUS";
150 constexpr const char* PERMISSION_GET_DEFAULT_APPLICATION = "ohos.permission.GET_DEFAULT_APPLICATION";
151 constexpr const char* PERMISSION_SET_DEFAULT_APPLICATION = "ohos.permission.SET_DEFAULT_APPLICATION";
152 constexpr const char* PERMISSION_GET_INSTALLED_BUNDLE_LIST = "ohos.permission.GET_INSTALLED_BUNDLE_LIST";
153 constexpr const char* PERMISSION_INSTALL_SELF_BUNDLE = "ohos.permission.INSTALL_SELF_BUNDLE";
154 constexpr const char* PERMISSION_UNINSTALL_BUNDLE = "ohos.permission.UNINSTALL_BUNDLE";
155 constexpr const char* PERMISSION_RECOVER_BUNDLE = "ohos.permission.RECOVER_BUNDLE";
156 // install list permissions file
157 constexpr const char* INSTALL_LIST_PERMISSIONS_FILE_PATH = "/system/etc/app/install_list_permissions.json";
158 
159 enum class AppType {
160     SYSTEM_APP = 0,
161     THIRD_SYSTEM_APP,
162     THIRD_PARTY_APP,
163 };
164 
165 constexpr const char* ACTION_VIEW_DATA = "ohos.want.action.viewData";
166 constexpr const char* ACTION_HOME = "action.system.home";
167 constexpr const char* WANT_ACTION_HOME = "ohos.want.action.home";
168 constexpr const char* ENTITY_HOME = "entity.system.home";
169 constexpr const char* FLAG_HOME_INTENT_FROM_SYSTEM = "flag.home.intent.from.system";
170 
171 // the ability file folder name.
172 constexpr const char* LIB_FOLDER_NAME = "libs";
173 constexpr const char* RES_FOLDER_NAME = "resources";
174 
175 constexpr uint8_t MAX_LABLE_LEN = 30;
176 constexpr uint8_t MAX_BUNDLE_NAME = 127;
177 constexpr uint8_t MIN_BUNDLE_NAME = 7;
178 constexpr uint8_t MAX_VENDOR = 255;
179 constexpr uint8_t EQUAL_ZERO = 0;
180 constexpr uint8_t MAX_MODULE_PACKAGE = 127;
181 constexpr uint8_t MAX_MODULE_NAME = 31;
182 constexpr uint8_t MAX_MODULE_ABILITIES_READPERMISSION = 255;
183 constexpr uint8_t MAX_MODULE_ABILITIES_WRITEPERMISSION = 255;
184 constexpr uint8_t MAX_MODULE_SHORTCUTID = 63;
185 constexpr uint8_t MAX_MODULE_LABEL = 63;
186 constexpr uint8_t MAX_JSON_ELEMENT_LENGTH = 255;
187 constexpr uint16_t MAX_JSON_ARRAY_LENGTH = 512;
188 // max number of haps under one direction
189 constexpr uint8_t MAX_HAP_NUMBER = 128;
190 
191 // single max hap size
192 constexpr int64_t ONE_GB = 1024 * 1024 * 1024;
193 constexpr int64_t MAX_HAP_SIZE = ONE_GB * 4;  // 4GB
194 
195 constexpr const char* UID = "uid";
196 constexpr const char* USER_ID = "userId";
197 constexpr const char* BUNDLE_NAME = "bundleName";
198 constexpr const char* MODULE_NAME = "moduleName";
199 constexpr const char* ABILITY_NAME = "abilityName";
200 constexpr const char* HAP_PATH = "hapPath";
201 constexpr int32_t MAX_LIMIT_SIZE = 4;
202 
203 constexpr const char* DATA_ABILITY_URI_PREFIX = "dataability://";
204 const char DATA_ABILITY_URI_SEPARATOR = '/';
205 
206 constexpr const char* PARAM_URI_SEPARATOR = ":///";
207 constexpr uint32_t PARAM_URI_SEPARATOR_LEN = 4;
208 constexpr const char* URI_SEPARATOR = "://";
209 constexpr uint32_t URI_SEPARATOR_LEN = 3;
210 constexpr const char* SEPARATOR = "/";
211 
212 constexpr int MAX_DIMENSION_SIZE = 10;
213 constexpr int MAX_DEVICETYPE_SIZE = 50;
214 
215 // appFeature
216 constexpr const char* HOS_NORMAL_APP = "hos_normal_app";
217 constexpr const char* HOS_SYSTEM_APP = "hos_system_app";
218 
219 // rdb
220 constexpr const char* BUNDLE_RDB_NAME = "/bmsdb.db";
221 constexpr const char* BUNDLE_RDB_TABLE_NAME = "installed_bundle";
222 constexpr const char* PRE_BUNDLE_RDB_TABLE_NAME = "preinstalled_bundle";
223 constexpr const char* DEFAULT_APP_RDB_TABLE_NAME = "default_app";
224 constexpr const char* QUICK_FIX_RDB_TABLE_NAME = "quick_fix";
225 constexpr const char* SAND_BOX_RDB_TABLE_NAME = "sandbox";
226 const int32_t BUNDLE_RDB_VERSION = 1;
227 
228 // ipc
229 constexpr int32_t ASHMEM_THRESHOLD  = 200 * 1024; // 200K
230 constexpr int32_t CAPACITY_SIZE = 1 * 1024 * 1000; // 1M
231 constexpr int32_t MAX_CAPACITY_BUNDLES = 5 * 1024 * 1000; // 5M
232 
233 // file size
234 constexpr int32_t INVALID_FILE_SIZE = -1;
235 
236 // permission
237 constexpr const char* LISTEN_BUNDLE_CHANGE = "ohos.permission.LISTEN_BUNDLE_CHANGE";
238 
239 // sandbox application
240 constexpr const char* SANDBOX_APP_INDEX = "sandbox_app_index";
241 constexpr int32_t INITIAL_APP_INDEX = 0;
242 constexpr int32_t MAX_APP_INDEX = 100;
243 
244 // app-distribution-type
245 constexpr const char* APP_DISTRIBUTION_TYPE_NONE = "none";
246 constexpr const char* APP_DISTRIBUTION_TYPE_APP_GALLERY = "app_gallery";
247 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE = "enterprise";
248 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_NORMAL = "enterprise_normal";
249 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_MDM = "enterprise_mdm";
250 constexpr const char* APP_DISTRIBUTION_TYPE_OS_INTEGRATION = "os_integration";
251 constexpr const char* APP_DISTRIBUTION_TYPE_CROWDTESTING = "crowdtesting";
252 // app provision type
253 constexpr const char* APP_PROVISION_TYPE_DEBUG = "debug";
254 constexpr const char* APP_PROVISION_TYPE_RELEASE = "release";
255 
256 // crowdtesting
257 constexpr int64_t INVALID_CROWDTEST_DEADLINE = -1;
258 
259 // thread pool
260 constexpr const char* RELATIVE_PATH = "../";
261 
262 // app detail ability
263 constexpr const char* APP_DETAIL_ABILITY = "AppDetailAbility";
264 
265 // overlay installation
266 constexpr int32_t DEFAULT_OVERLAY_ENABLE_STATUS = 1;
267 constexpr int32_t DEFAULT_OVERLAY_DISABLE_STATUS = 0;
268 constexpr int32_t OVERLAY_MINIMUM_PRIORITY = 1;
269 constexpr int32_t OVERLAY_MAXIMUM_PRIORITY = 100;
270 constexpr const char* OVERLAY_STATE = "overlayState";
271 constexpr const char* PERMISSION_CHANGE_OVERLAY_ENABLED_STATE = "ohos.permission.CHANGE_OVERLAY_ENABLED_STATE";
272 
273 // ark compile mode
274 constexpr const char* COMPILE_NONE = "none";
275 constexpr const char* COMPILE_PARTIAL = "partial";
276 constexpr const char* COMPILE_FULL = "full";
277 
278 constexpr const char* ARK_CACHE_PATH = "/data/local/ark-cache/";
279 constexpr const char* ARK_PROFILE_PATH = "/data/local/ark-profile/";
280 
281 // code signature
282 constexpr const char* CODE_SIGNATURE_FILE_SUFFIX = ".sig";
283 constexpr const char* CODE_SIGNATURE_HAP = "Hap";
284 constexpr const char* SIGNATURE_FILE_PATH = "signature_files";
285 constexpr const char* SECURITY_SIGNATURE_FILE_PATH = "security_signature_files";
286 
287 // system param
288 const std::string ALLOW_ENTERPRISE_BUNDLE = "const.bms.allowenterprisebundle";
289 
290 // hmdfs and sharefs config
291 constexpr const char* HMDFS_CONFIG_PATH = "/config/hmdfs/";
292 constexpr const char* SHAREFS_CONFIG_PATH = "/config/sharefs/";
293 }  // namespace Constants
294 }  // namespace AppExecFwk
295 }  // namespace OHOS
296 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H
297