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_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_SERVICE_CONSTANTS_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_SERVICE_CONSTANTS_H
18 
19 #include <map>
20 #include <set>
21 #include <string>
22 #include <vector>
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 namespace ServiceConstants {
27 constexpr const char* ASSETS_DIR = "assets";
28 constexpr const char* RESOURCES_INDEX = "resources.index";
29 constexpr int8_t INVALID_GID = -1;
30 constexpr int8_t BUNDLE_RDB_VERSION = 1;
31 constexpr const char* PATH_SEPARATOR = "/";
32 constexpr const char* LIBS = "libs/";
33 constexpr const char* AN = "an/";
34 constexpr const char* RES_FILE_PATH = "resources/resfile/";
35 constexpr const char* HNPS_FILE_PATH = "hnp_tmp_extract_dir/";
36 constexpr const char* HNPS = "hnp/";
37 constexpr const char* DIR_EL1 = "el1";
38 constexpr const char* DIR_EL2 = "el2";
39 constexpr const char* DIR_EL3 = "el3";
40 constexpr const char* DIR_EL4 = "el4";
41 constexpr const char* DIR_EL5 = "el5";
42 const std::vector<std::string> BUNDLE_EL = {DIR_EL1, DIR_EL2, DIR_EL3, DIR_EL4};
43 constexpr const char* ARM_EABI = "armeabi";
44 constexpr const char* ARM_EABI_V7A = "armeabi-v7a";
45 constexpr const char* ARM64_V8A = "arm64-v8a";
46 constexpr const char* ARM64 = "arm64";
47 constexpr const char* X86 = "x86";
48 constexpr const char* X86_64 = "x86_64";
49 const std::map<std::string, std::string> ABI_MAP = {
50     {ARM_EABI, "arm"},
51     {ARM_EABI_V7A, "arm"},
52     {ARM64_V8A, "arm64"},
53     {X86, "x86"},
54     {X86_64, "x86_64"},
55 };
56 constexpr const char* CLONE_BUNDLE_PREFIX = "clone_";
57 constexpr const char* INSTALL_FILE_SUFFIX = ".hap";
58 constexpr const char* HSP_FILE_SUFFIX = ".hsp";
59 constexpr const char* QUICK_FIX_FILE_SUFFIX = ".hqf";
60 const char FILE_SEPARATOR_CHAR = '/';
61 constexpr const char* CURRENT_DEVICE_ID = "PHONE-001";
62 constexpr const char* HAP_COPY_PATH = "/data/service/el1/public/bms/bundle_manager_service";
63 constexpr const char* TMP_SUFFIX = "_tmp";
64 constexpr const char* BUNDLE_APP_DATA_BASE_DIR = "/data/app/";
65 constexpr const char* BASE = "/base/";
66 constexpr const char* CLONE = "clone";
67 constexpr const char* PLUS_SIGN = "+";
68 constexpr const char* MINUS_SIGN = "-";
69 constexpr const char* DATABASE = "/database/";
70 constexpr const char* LOG = "/log/";
71 constexpr const char* HAPS = "/haps/";
72 constexpr const char* EXTENSION_DIR = "+extension-";
73 constexpr const char* FILE_SEPARATOR_LINE = "-";
74 constexpr const char* FILE_SEPARATOR_PLUS = "+";
75 constexpr const char* BUNDLE_MANAGER_SERVICE_PATH = "/data/service/el1/public/bms/bundle_manager_service";
76 constexpr const char* SANDBOX_DATA_PATH = "/data/storage/el2/base";
77 constexpr const char* REAL_DATA_PATH = "/data/app/el2";
78 constexpr const char* DATA_GROUP_PATH = "/group/";
79 constexpr const char* STREAM_INSTALL_PATH = "stream_install";
80 constexpr const char* SECURITY_STREAM_INSTALL_PATH = "security_stream_install";
81 constexpr const char* QUICK_FIX_PATH = "quick_fix";
82 constexpr const char* SECURITY_QUICK_FIX_PATH = "security_quick_fix";
83 constexpr const char* BUNDLE_ASAN_LOG_DIR = "/data/local/app-logs";
84 constexpr const char* SCREEN_LOCK_FILE_DATA_PATH = "/data/app/el5";
85 constexpr int NOT_EXIST_USERID = -5;
86 constexpr int PATH_MAX_SIZE = 256;
87 constexpr int32_t API_VERSION_NINE = 9;
88 constexpr int32_t API_VERSION_TWELVE = 12;
89 constexpr int32_t API_VERSION_THIRTEEN = 13;
90 constexpr int32_t API_VERSION_MOD = 1000;
91 constexpr int32_t BACKUP_DEFAULT_APP_KEY = -2;
92 // native so
93 constexpr const char* ABI_DEFAULT = "default";
94 constexpr const char* ABI_SEPARATOR = ",";
95 constexpr const char* MODULE_NAME_SEPARATOR = ",";
96 constexpr const char* AN_SUFFIX = ".an";
97 constexpr const char* AP_SUFFIX = ".ap";
98 constexpr const char* SYSTEM_LIB64 = "/system/lib64";
99 constexpr const char* PATCH_PATH = "patch_";
100 constexpr const char* HOT_RELOAD_PATH = "hotreload_";
101 // uid and gid
102 constexpr int32_t BMS_UID = 1000;
103 constexpr int32_t SHELL_UID = 2000;
104 constexpr int32_t BACKU_HOME_GID = 1089;
105 constexpr int32_t ACCOUNT_UID = 3058;
106 constexpr int32_t MODULE_UPDATE_UID = 6666;
107 constexpr int32_t BMS_GID = 1000;
108 constexpr int32_t DATABASE_DIR_GID = 3012;
109 constexpr int32_t DFS_GID = 1009;
110 constexpr int32_t LOG_DIR_GID = 1007;
111 // permissions
112 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_BUNDLE";
113 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_NORMAL_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE";
114 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_MDM_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE";
115 constexpr const char* PERMISSION_INSTALL_INTERNALTESTING_BUNDLE = "ohos.permission.INSTALL_INTERNALTESTING_BUNDLE";
116 constexpr const char* PERMISSION_MANAGE_DISPOSED_APP_STATUS = "ohos.permission.MANAGE_DISPOSED_APP_STATUS";
117 constexpr const char* PERMISSION_INSTALL_SELF_BUNDLE = "ohos.permission.INSTALL_SELF_BUNDLE";
118 constexpr const char* PERMISSION_UNINSTALL_BUNDLE = "ohos.permission.UNINSTALL_BUNDLE";
119 constexpr const char* PERMISSION_RECOVER_BUNDLE = "ohos.permission.RECOVER_BUNDLE";
120 constexpr const char* PERMISSION_GET_BUNDLE_RESOURCES = "ohos.permission.GET_BUNDLE_RESOURCES";
121 constexpr const char* PERMISSION_INSTALL_SANDBOX_BUNDLE = "ohos.permission.INSTALL_SANDBOX_BUNDLE";
122 constexpr const char* PERMISSION_UNINSTALL_SANDBOX_BUNDLE = "ohos.permission.UNINSTALL_SANDBOX_BUNDLE";
123 constexpr const char* PERMISSION_INSTALL_QUICK_FIX_BUNDLE = "ohos.permission.INSTALL_QUICK_FIX_BUNDLE";
124 constexpr const char* PERMISSION_UNINSTALL_QUICK_FIX_BUNDLE = "ohos.permission.UNINSTALL_QUICK_FIX_BUNDLE";
125 constexpr const char* PERMISSION_CHANGE_BUNDLE_UNINSTALL_STATE = "ohos.permission.CHANGE_BUNDLE_UNINSTALL_STATE";
126 
127 constexpr const char* FLAG_HOME_INTENT_FROM_SYSTEM = "flag.home.intent.from.system";
128 // max number of haps under one direction
129 constexpr uint8_t MAX_HAP_NUMBER = 128;
130 constexpr const char* DATA_ABILITY_URI_PREFIX = "dataability://";
131 // appFeature
132 constexpr const char* HOS_SYSTEM_APP = "hos_system_app";
133 // rdb
134 constexpr const char* BUNDLE_RDB_NAME = "/bmsdb.db";
135 // thread pool
136 constexpr const char* RELATIVE_PATH = "../";
137 // app detail ability
138 constexpr const char* APP_DETAIL_ABILITY = "AppDetailAbility";
139 // overlay installation
140 constexpr int32_t DEFAULT_OVERLAY_ENABLE_STATUS = 1;
141 constexpr int32_t DEFAULT_OVERLAY_DISABLE_STATUS = 0;
142 constexpr int32_t OVERLAY_MINIMUM_PRIORITY = 1;
143 // ark compile mode
144 constexpr const char* COMPILE_PARTIAL = "partial";
145 constexpr const char* ARK_CACHE_PATH = "/data/local/ark-cache/";
146 constexpr const char* ARK_PROFILE_PATH = "/data/local/ark-profile/";
147 // code signature
148 constexpr const char* CODE_SIGNATURE_FILE_SUFFIX = ".sig";
149 constexpr const char* CODE_SIGNATURE_HAP = "Hap";
150 constexpr const char* SIGNATURE_FILE_PATH = "signature_files";
151 constexpr const char* SECURITY_SIGNATURE_FILE_PATH = "security_signature_files";
152 //pgo file
153 constexpr const char* PGO_FILE_SUFFIX = ".ap";
154 // system param
155 constexpr const char* ALLOW_ENTERPRISE_BUNDLE = "const.bms.allowenterprisebundle";
156 constexpr const char* IS_ENTERPRISE_DEVICE = "const.edm.is_enterprise_device";
157 constexpr const char* DEVELOPERMODE_STATE = "const.security.developermode.state";
158 //extResource
159 constexpr const char* EXT_RESOURCE_FILE_PATH = "ext_resource";
160 // hmdfs and sharefs config
161 constexpr const char* HMDFS_CONFIG_PATH = "/config/hmdfs/";
162 constexpr const char* SHAREFS_CONFIG_PATH = "/config/sharefs/";
163 constexpr const char* SYSTEM_SERVICE_DIR = "/data/service/el1/public";
164 constexpr const char* SYSTEM_UI_BUNDLE_NAME = "com.ohos.systemui";
165 constexpr const char* LAUNCHER_BUNDLE_NAME = "com.ohos.launcher";
166 // clone application
167 constexpr int32_t CLONE_APP_INDEX_MIN = 1;
168 constexpr int32_t CLONE_APP_INDEX_MAX = 5;
169 // shader
170 constexpr const char* SHADER_CACHE_PATH = "/data/local/shader_cache/local/";
171 constexpr const char* CLOUD_SHADER_PATH = "/data/local/shader_cache/cloud/";
172 constexpr const char* CLOUD_SHADER_OWNER = "const.appgallery.shaderowner.bundlename";
173 // apiReleaseType
174 constexpr const char* API_RELEASE_TYPE_RELEASE = "Release";
175 constexpr const char* API_RELEASE_TYPE_BETA = "Beta";
176 constexpr const char* API_RELEASE_TYPE_CANARY = "Canary";
177 // allow multi icon bundle
178 const std::set<std::string> ALLOW_MULTI_ICON_BUNDLE = {
179     "com.ohos.contacts"
180 };
181 }  // namespace ServiceConstants
182 }  // namespace AppExecFwk
183 }  // namespace OHOS
184 #endif  // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_SERVICE_CONSTANTS_H