• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 const std::string EMPTY_STRING = "";
27 constexpr const char* BUNDLE_PROFILE_NAME = "config.json";
28 constexpr const char* MODULE_PROFILE_NAME = "module.json";
29 constexpr const char* PATCH_PROFILE_NAME = "patch.json";
30 constexpr const char* BUNDLE_PACKFILE_NAME = "pack.info";
31 constexpr const char* SYSCAP_NAME = "rpcid.sc";
32 constexpr const char* INSTALL_FILE_SUFFIX = ".hap";
33 constexpr const char* INSTALL_SHARED_FILE_SUFFIX = ".hsp";
34 constexpr const char* QUICK_FIX_FILE_SUFFIX = ".hqf";
35 constexpr const char* PROFILE_FILE_PREFIX = "$profile:";
36 const std::string PATH_SEPARATOR = "/";
37 constexpr const char* FILE_UNDERLINE = "_";
38 constexpr const char* ILLEGAL_PATH_FIELD = "../";
39 const char FILE_SEPARATOR_CHAR = '/';
40 constexpr const char* CURRENT_DEVICE_ID = "PHONE-001";
41 constexpr const char* BUNDLE_DATA_BASE_FILE = "/data/bundlemgr/bmsdb.json";
42 constexpr const char* SYSTEM_APP_SCAN_PATH = "/system/app";
43 constexpr const char* SYSTEM_RESOURCES_APP_PATH = "/system/app/ohos.global.systemres";
44 constexpr const char* SYSTEM_APP_INSTALL_PATH = "/data/app/el1/bundle";
45 constexpr const char* THIRD_SYSTEM_APP_SCAN_PATH = "/system/vendor";
46 constexpr const char* THIRD_SYSTEM_APP_INSTALL_PATH = "/data/app/el1/bundle";
47 constexpr const char* THIRD_PARTY_APP_INSTALL_PATH = "/data/app/el1/bundle";
48 constexpr const char* HAP_COPY_PATH = "/data/service/el1/public/bms/bundle_manager_service";
49 constexpr const char* CACHE_DIR = "cache";
50 constexpr const char* TMP_SUFFIX = "_tmp";
51 constexpr const char* ASSETS_DIR = "assets";
52 constexpr const char* RESOURCES_INDEX = "resources.index";
53 constexpr const char* BUNDLE_CODE_DIR = "/data/app/el1/bundle/public";
54 constexpr const char* BUNDLE_BASE_CODE_DIR = "/data/app/el1/bundle";
55 constexpr const char* BUNDLE_APP_DATA_BASE_DIR = "/data/app/";
56 constexpr const char* BASE = "/base/";
57 constexpr const char* DATABASE = "/database/";
58 constexpr const char* HAPS = "/haps/";
59 constexpr const char* BUNDLE_MANAGER_SERVICE_PATH = "/data/service/el1/public/bms/bundle_manager_service";
60 constexpr const char* BUNDLE_USER_INFO_PATH =
61     "/data/service/el1/public/bms/bundle_manager_service/bundle_user_info.json";
62 constexpr const char* BUNDLE_BACKUP_HOME_PATH  = "/data/service/el2/%/backup/bundles/";
63 constexpr const char* DISTRIBUTED_FILE = "/data/service/el2/%/hmdfs/account/data/";
64 constexpr const char* SHARE_FILE_PATH = "/data/service/el2/%/share/";
65 constexpr const char* DISTRIBUTED_FILE_NON_ACCOUNT = "/data/service/el2/%/hmdfs/non_account/data/";
66 constexpr const char* COMPRESS_PROPERTY = "compress";
67 constexpr const char* SANDBOX_DATA_PATH = "/data/storage/el2/base";
68 constexpr const char* REAL_DATA_PATH = "/data/app/el2";
69 constexpr const char* STREAM_INSTALL_PATH = "stream_install";
70 constexpr const char* QUICK_FIX_PATH = "quick_fix";
71 constexpr const char* DEVICE_TYPE_OF_DEFAULT = "default";
72 constexpr const char* DEVICE_TYPE_OF_PHONE = "phone";
73 constexpr const char* BUNDLE_ASAN_LOG_DIR = "/data/local/app-logs";
74 const std::vector<std::string> BUNDLE_EL = {"el1", "el2"};
75 const std::vector<std::string> BUNDLE_DATA_DIR = {
76     "/cache",
77     "/files",
78     "/temp",
79     "/preferences",
80     "/haps"
81 };
82 
83 constexpr const char* BMS_SERVICE_NAME = "BundleMgrService";
84 constexpr const char* QUICK_FIX_MGR = "QuickFixMgr";
85 constexpr const char* INSTALLD_SERVICE_NAME = "installd";
86 constexpr const char* SYSTEM_APP = "system";
87 constexpr const char* THIRD_PARTY_APP = "third-party";
88 constexpr const char* ACCESS_TOKEN_ID = "accessTokenId";
89 constexpr const char* IS_AGING_UNINSTALL = "isAgingUninstall";
90 constexpr int START_USERID = 100;
91 constexpr int DEFAULT_USERID = 0;
92 constexpr int INVALID_USERID = -1;
93 constexpr int UNSPECIFIED_USERID = -2;
94 constexpr int ALL_USERID = -3;
95 constexpr int ANY_USERID = -4;
96 constexpr int NOT_EXIST_USERID = -5;
97 constexpr int PATH_MAX_SIZE = 256;
98 constexpr int SIGNATURE_MATCHED = 0;
99 constexpr int SIGNATURE_NOT_MATCHED = 1;
100 constexpr int SIGNATURE_UNKNOWN_BUNDLE = 2;
101 constexpr int PERMISSION_GRANTED = 0;
102 constexpr int PERMISSION_NOT_GRANTED = -1;
103 constexpr int DUMP_INDENT = 4;
104 constexpr unsigned int INSTALLD_UMASK = 0000;
105 constexpr int32_t INVALID_API_VERSION = -1;
106 constexpr int32_t API_VERSION_EIGHT = 8;
107 constexpr int32_t API_VERSION_NINE = 9;
108 
109 // native so
110 constexpr const char* ABI_DEFAULT = "default";
111 constexpr const char* ABI_SEPARATOR = ",";
112 constexpr const char* ARM_EABI = "armeabi";
113 constexpr const char* ARM_EABI_V7A = "armeabi-v7a";
114 constexpr const char* ARM64_V8A = "arm64-v8a";
115 constexpr const char* X86 = "x86";
116 constexpr const char* X86_64 = "x86_64";
117 const std::string LIBS = "libs/";
118 const std::string AN = "an/";
119 const std::string AP = "ap/";
120 constexpr const char* LIBS_ARM_EABI_V7A = "libs/armeabi-v7a/";
121 constexpr const char* ARM = "arm";
122 const std::map<std::string, std::string> ABI_MAP = {
123     {ARM_EABI, "arm"},
124     {ARM_EABI_V7A, "arm"},
125     {ARM64_V8A, "arm64"},
126     {X86, "x86"},
127     {X86_64, "x86_64"},
128 };
129 constexpr const char* SO_SUFFIX = ".so";
130 constexpr const char* AN_SUFFIX = ".an";
131 constexpr const char* AI_SUFFIX = ".ai";
132 constexpr const char* AP_SUFFIX = ".ap";
133 constexpr const char* SYSTEM_LIB64 = "/system/lib64";
134 constexpr const char* DIFF_SUFFIX = ".diff";
135 constexpr const char* PATCH_PATH = "patch_";
136 constexpr const char* HOT_RELOAD_PATH = "hotreload_";
137 
138 // uid and gid
139 constexpr int32_t INVALID_UID = -1;
140 constexpr int32_t INVALID_GID = -1;
141 constexpr int32_t INVALID_BUNDLEID = -1;
142 constexpr int32_t INVALID_ACCESS_TOKEN_ID = -1;
143 constexpr int32_t ROOT_UID = 0;
144 constexpr int32_t BMS_UID = 1000;
145 constexpr int32_t SHELL_UID = 2000;
146 constexpr int32_t BACKU_HOME_GID = 1089;
147 constexpr int32_t ACCOUNT_UID = 3058;
148 constexpr int32_t FOUNDATION_UID = 5523;
149 constexpr int32_t BMS_GID = 1000;
150 constexpr int32_t BASE_SYS_UID = 2100;
151 constexpr int32_t MAX_SYS_UID = 2899;
152 constexpr int32_t BASE_SYS_VEN_UID = 5000;
153 constexpr int32_t MAX_SYS_VEN_UID = 5999;
154 constexpr int32_t BASE_APP_UID = 10000;
155 constexpr int32_t BASE_USER_RANGE = 200000;
156 constexpr int32_t MAX_APP_UID = 65535;
157 constexpr int32_t U_VALUE = 100000;
158 constexpr int32_t DATABASE_DIR_GID = 3012;
159 constexpr int32_t DFS_GID = 1009;
160 constexpr const char* PROFILE_KEY_UID_SIZE = "size";
161 constexpr const char* PROFILE_KEY_UID_AND_GID = "uid_and_gid";
162 constexpr const char* FOUNDATION_PROCESS_NAME = "foundation";
163 
164 // permissions
165 constexpr const char* PERMISSION_INSTALL_BUNDLE = "ohos.permission.INSTALL_BUNDLE";
166 constexpr const char* PERMISSION_GET_BUNDLE_INFO = "ohos.permission.GET_BUNDLE_INFO";
167 constexpr const char* PERMISSION_GET_BUNDLE_INFO_PRIVILEGED = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
168 constexpr const char* PERMISSION_CHANGE_ABILITY_ENABLED_STATE = "ohos.permission.CHANGE_ABILITY_ENABLED_STATE";
169 constexpr const char* PERMISSION_REMOVECACHEFILE = "ohos.permission.REMOVE_CACHE_FILES";
170 constexpr const char* PERMISSION_MANAGE_DISPOSED_APP_STATUS = "ohos.permission.MANAGE_DISPOSED_APP_STATUS";
171 constexpr const char* PERMISSION_GET_DEFAULT_APPLICATION = "ohos.permission.GET_DEFAULT_APPLICATION";
172 constexpr const char* PERMISSION_SET_DEFAULT_APPLICATION = "ohos.permission.SET_DEFAULT_APPLICATION";
173 // install list permissions file
174 constexpr const char* INSTALL_LIST_PERMISSIONS_FILE_PATH = "/system/etc/app/install_list_permissions.json";
175 
176 enum class AppType {
177     SYSTEM_APP = 0,
178     THIRD_SYSTEM_APP,
179     THIRD_PARTY_APP,
180 };
181 
182 constexpr const char* ACTION_HOME = "action.system.home";
183 constexpr const char* WANT_ACTION_HOME = "ohos.want.action.home";
184 constexpr const char* ENTITY_HOME = "entity.system.home";
185 constexpr const char* FLAG_HOME_INTENT_FROM_SYSTEM = "flag.home.intent.from.system";
186 
187 // the ability file folder name.
188 constexpr const char* LIB_FOLDER_NAME = "libs";
189 constexpr const char* RES_FOLDER_NAME = "resources";
190 
191 constexpr uint8_t MAX_LABLE_LEN = 30;
192 constexpr uint8_t MAX_BUNDLE_NAME = 255;
193 constexpr uint8_t MIN_BUNDLE_NAME = 7;
194 constexpr uint8_t MAX_VENDOR = 255;
195 constexpr uint8_t EQUAL_ZERO = 0;
196 constexpr uint8_t MAX_MODULE_PACKAGE = 127;
197 constexpr uint8_t MAX_MODULE_NAME = 255;
198 constexpr uint8_t MAX_MODULE_ABILITIES_READPERMISSION = 255;
199 constexpr uint8_t MAX_MODULE_ABILITIES_WRITEPERMISSION = 255;
200 constexpr uint8_t MAX_MODULE_SHORTCUTID = 63;
201 constexpr uint8_t MAX_MODULE_LABEL = 63;
202 constexpr uint8_t MAX_JSON_ELEMENT_LENGTH = 255;
203 constexpr uint16_t MAX_JSON_ARRAY_LENGTH = 512;
204 // max number of haps under one direction
205 constexpr uint8_t MAX_HAP_NUMBER = 128;
206 
207 // distributed database
208 constexpr const char* APP_ID = "bundle_manager_service";
209 constexpr const char* STORE_ID = "installed_bundle_datas";
210 constexpr const char* ABILITY_USAGE_STORE_ID = "ability_usage_datas";
211 constexpr const char* PRE_INSTALL_DATA_STORE_ID = "preinstall_usage_datas";
212 constexpr const char* DISTRIBUTE_DATA_STORE_ID = "distribute_bundle_datas";
213 constexpr const char* DEFAULT_APP_DATA_STORE_ID = "default_app_datas";
214 
215 // single max hap size
216 constexpr int64_t ONE_GB = 1024 * 1024 * 1024;
217 constexpr int64_t MAX_HAP_SIZE = ONE_GB * 4;  // 4GB
218 
219 constexpr const char* UID = "uid";
220 constexpr const char* USER_ID = "userId";
221 constexpr const char* BUNDLE_NAME = "bundleName";
222 constexpr const char* MODULE_NAME = "moduleName";
223 constexpr const char* ABILITY_NAME = "abilityName";
224 constexpr const char* HAP_PATH = "hapPath";
225 constexpr int32_t MAX_LIMIT_SIZE = 4;
226 
227 constexpr const char* DATA_ABILITY_URI_PREFIX = "dataability://";
228 const char DATA_ABILITY_URI_SEPARATOR = '/';
229 
230 constexpr const char* PARAM_URI_SEPARATOR = ":///";
231 constexpr uint32_t PARAM_URI_SEPARATOR_LEN = 4;
232 constexpr const char* URI_SEPARATOR = "://";
233 constexpr uint32_t URI_SEPARATOR_LEN = 3;
234 constexpr const char* SEPARATOR = "/";
235 
236 constexpr int MAX_DIMENSION_SIZE = 10;
237 constexpr int MAX_DEVICETYPE_SIZE = 50;
238 
239 // appFeature
240 constexpr const char* HOS_NORMAL_APP = "hos_normal_app";
241 constexpr const char* HOS_SYSTEM_APP = "hos_system_app";
242 constexpr const char* OHOS_SYSTEM_APP = "ohos_system_app";
243 
244 // rdb
245 constexpr const char* BUNDLE_RDB_NAME = "/bmsdb.db";
246 constexpr const char* BUNDLE_RDB_TABLE_NAME = "installed_bundle";
247 constexpr const char* PRE_BUNDLE_RDB_TABLE_NAME = "preinstalled_bundle";
248 constexpr const char* DEFAULT_APP_RDB_TABLE_NAME = "default_app";
249 constexpr const char* QUICK_FIX_RDB_TABLE_NAME = "quick_fix";
250 constexpr const char* JOURNAL_MODE = "WAL";
251 constexpr const char* SYNC_MODE = "MODE_OFF";
252 const int32_t BUNDLE_RDB_VERSION = 1;
253 
254 // ipc
255 constexpr int32_t CAPACITY_SIZE = 1 * 1024 * 1000; // 1M
256 constexpr int32_t MAX_CAPACITY_BUNDLES = 5 * 1024 * 1000; // 5M
257 
258 // file size
259 constexpr int32_t INVALID_FILE_SIZE = -1;
260 
261 // permission
262 constexpr const char* LISTEN_BUNDLE_CHANGE = "ohos.permission.LISTEN_BUNDLE_CHANGE";
263 
264 // hmdfs and sharefs config
265 constexpr const char* HMDFS_CONFIG_PATH {"/config/hmdfs/"};
266 constexpr const char* SHAREFS_CONFIG_PATH {"/config/sharefs/"};
267 constexpr const char* BUNDLE_ID_FILE = { "appid" };
268 
269 // pre bundle profile
270 constexpr const char* DEFAULT_PRE_BUNDLE_ROOT_DIR = "/system";
271 constexpr const char* PRODUCT_SUFFIX = "/etc/app";
272 constexpr const char* INSTALL_LIST_CONFIG = "/install_list.json";
273 constexpr const char* UNINSTALL_LIST_CONFIG = "/uninstall_list.json";
274 constexpr const char* INSTALL_LIST_CAPABILITY_CONFIG = "/install_list_capability.json";
275 constexpr const char* INSTALL_LIST_PERMISSIONS_CONFIG = "/install_list_permissions.json";
276 
277 // sandbox application
278 constexpr const char* SANDBOX_APP_INDEX = "sandbox_app_index";
279 constexpr int32_t INITIAL_APP_INDEX = 0;
280 constexpr int32_t MAX_APP_INDEX = 100;
281 
282 // disposed status
283 constexpr int32_t DEFAULT_DISPOSED_STATUS = 0;
284 
285 // app-distribution-type
286 constexpr const char* APP_DISTRIBUTION_TYPE_NONE = "none";
287 constexpr const char* APP_DISTRIBUTION_TYPE_APP_GALLERY = "app_gallery";
288 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE = "enterprise";
289 constexpr const char* APP_DISTRIBUTION_TYPE_OS_INTEGRATION = "os_integration";
290 constexpr const char* APP_DISTRIBUTION_TYPE_CROWDTESTING = "crowdtesting";
291 // app provision type
292 constexpr const char* APP_PROVISION_TYPE_DEBUG = "debug";
293 constexpr const char* APP_PROVISION_TYPE_RELEASE = "release";
294 
295 // crowdtesting
296 constexpr int64_t INVALID_CROWDTEST_DEADLINE = -1;
297 
298 // syscap
299 constexpr const char* SYSCAP_SERVICE_ID = "syscap";
300 constexpr const char* SYSCAP_SERVICE_TYPE = "syscap";
301 constexpr const char* CHARACTER_OS_SYSCAP = "ossyscap";
302 constexpr const char* CHARACTER_PRIVATE_SYSCAP = "privatesyscap";
303 
304 // thread pool
305 constexpr int32_t MAX_TASK_NUMBER = 10;
306 constexpr const char* RELATIVE_PATH = "../";
307 
308 // app detail ability
309 constexpr const char* APP_DETAIL_ABILITY = "AppDetailAbility";
310 }  // namespace Constants
311 }  // namespace AppExecFwk
312 }  // namespace OHOS
313 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H
314