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