1 /* 2 * Copyright (c) 2021-2025 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 <set> 21 #include <string> 22 #include <vector> 23 24 #include "appexecfwk_errors.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 namespace Constants { 29 constexpr const char* TYPE_ONLY_MATCH_WILDCARD = "reserved/wildcard"; 30 constexpr const char* EMPTY_STRING = ""; 31 constexpr const char* FILE_UNDERLINE = "_"; 32 constexpr const char* BUNDLE_CODE_DIR = "/data/app/el1/bundle/public"; 33 constexpr const char* CACHE_DIR = "cache"; 34 constexpr int8_t START_USERID = 100; 35 constexpr int8_t DEFAULT_USERID = 0; 36 constexpr int8_t U1 = 1; 37 constexpr int8_t INVALID_USERID = -1; 38 constexpr int8_t UNSPECIFIED_USERID = -2; 39 constexpr int8_t ALL_USERID = -3; 40 constexpr int8_t ANY_USERID = -4; 41 constexpr int8_t PERMISSION_GRANTED = 0; 42 constexpr int8_t PERMISSION_NOT_GRANTED = -1; 43 constexpr int8_t DEFAULT_STREAM_FD = -1; 44 constexpr int8_t DUMP_INDENT = 4; 45 constexpr int8_t INVALID_API_VERSION = -1; 46 constexpr int8_t ALL_VERSIONCODE = -1; 47 constexpr int8_t INVALID_UDID = -1; 48 constexpr int8_t DEFAULT_INSTALLERID = -1; 49 constexpr int8_t DEFAULT_APP_INDEX = 0; 50 51 // uid and gid 52 constexpr int32_t INVALID_UID = -1; 53 constexpr int32_t ROOT_UID = 0; 54 constexpr int32_t FOUNDATION_UID = 5523; 55 constexpr int32_t CODE_PROTECT_UID = 7666; 56 constexpr int32_t BASE_APP_UID = 10000; 57 constexpr int32_t BASE_USER_RANGE = 200000; 58 constexpr int32_t MAX_APP_UID = 65535; 59 constexpr int32_t STORAGE_MANAGER_UID = 1090; 60 constexpr int32_t EDC_UID = 7200; 61 constexpr int32_t CODE_SIGN_UID = 3074; 62 63 // for render process 64 constexpr int32_t START_UID_FOR_RENDER_PROCESS = 1000000; 65 constexpr int32_t END_UID_FOR_RENDER_PROCESS = 1099999; 66 67 // no report for expected errcode 68 const std::set<int32_t> EXPECTED_ERROR = { 69 ERR_APPEXECFWK_INSTALL_APP_IN_BLOCKLIST, 70 ERR_APPEXECFWK_INSTALL_FAILED_AND_RESTORE_TO_PREINSTALLED, 71 ERR_APPEXECFWK_CLONE_INSTALL_APP_INDEX_EXISTED, 72 ERR_APPEXECFWK_CLONE_INSTALL_APP_NOT_EXISTED, 73 ERR_BUNDLE_MANAGER_APP_CONTROL_DISALLOWED_UNINSTALL, 74 ERR_APPEXECFWK_UNINSTALL_STATE_NOT_ALLOW, 75 ERR_APPEXECFWK_UNINSTALL_CONTROLLED 76 }; 77 78 /* 79 all of cache path for bundle: 80 modulename max is 128 81 /data/app/el1~el5/userid/base/bundlename/cache; 82 /data/app/el2/userid/sharefiles/bundlename/cache; 83 /data/app/el1~el5/userid/base/bundlename/haps/modulename/cache; 84 /data/app/el2/userid/sharefiles/bundlename/haps/modulename/cache; 85 */ 86 constexpr int16_t MAX_CACHE_DIR_SIZE = 774; 87 88 // permissions 89 constexpr const char* PERMISSION_U1_ENABLED = "ohos.permission.SUPPORT_INSTALL_ON_U1"; 90 constexpr const char* PERMISSION_INSTALL_BUNDLE = "ohos.permission.INSTALL_BUNDLE"; 91 constexpr const char* PERMISSION_UNINSTALL_CLONE_BUNDLE = "ohos.permission.UNINSTALL_CLONE_BUNDLE"; 92 constexpr const char* PERMISSION_GET_BUNDLE_INFO = "ohos.permission.GET_BUNDLE_INFO"; 93 constexpr const char* PERMISSION_GET_BUNDLE_INFO_PRIVILEGED = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"; 94 constexpr const char* PERMISSION_CHANGE_ABILITY_ENABLED_STATE = "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"; 95 constexpr const char* PERMISSION_REMOVECACHEFILE = "ohos.permission.REMOVE_CACHE_FILES"; 96 constexpr const char* PERMISSION_GET_DEFAULT_APPLICATION = "ohos.permission.GET_DEFAULT_APPLICATION"; 97 constexpr const char* PERMISSION_SET_DEFAULT_APPLICATION = "ohos.permission.SET_DEFAULT_APPLICATION"; 98 constexpr const char* PERMISSION_GET_INSTALLED_BUNDLE_LIST = "ohos.permission.GET_INSTALLED_BUNDLE_LIST"; 99 constexpr const char* PERMISSION_RUN_DYN_CODE = "ohos.permission.RUN_DYN_CODE"; 100 constexpr const char* PERMISSION_ACCESS_DYNAMIC_ICON = "ohos.permission.ACCESS_DYNAMIC_ICON"; 101 constexpr const char* PERMISSION_START_SHORTCUT = "ohos.permission.START_SHORTCUT"; 102 constexpr const char* PERMISSION_INSTALL_CLONE_BUNDLE = "ohos.permission.INSTALL_CLONE_BUNDLE"; 103 constexpr const char* PERMISSION_MANAGER_SHORTCUT = "ohos.permission.MANAGE_SHORTCUTS"; 104 constexpr const char* PERMISSION_ACCESS_APP_INSTALL_DIR = "ohos.permission.ACCESS_APP_INSTALL_DIR"; 105 constexpr const char* PERMISSION_GET_SIGNATURE_INFO = "ohos.permission.GET_SIGNATURE_INFO"; 106 constexpr const char* PERMISSION_MIGRATE_DATA = "ohos.permission.MIGRATE_DATA"; 107 constexpr const char* PERMISSION_INSTALL_PLUGIN = "ohos.permission.INSTALL_PLUGIN_BUNDLE"; 108 constexpr const char* PERMISSION_UNINSTALL_PLUGIN = "ohos.permission.UNINSTALL_PLUGIN_BUNDLE"; 109 constexpr const char* PERMISSION_PERFORM_LOCAL_DEBUG = "ohos.permission.PERFORM_LOCAL_DEBUG"; 110 constexpr const char* PERMISSION_GET_ABILITY_INFO = "ohos.permission.GET_ABILITY_INFO"; 111 constexpr const char* PERMISSION_BMS_INTERACT_ACROSS_LOCAL_ACCOUNTS = "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS"; 112 113 enum class AppType { 114 SYSTEM_APP = 0, 115 THIRD_SYSTEM_APP, 116 THIRD_PARTY_APP, 117 }; 118 119 enum NoGetBundleStatsFlag : uint32_t { 120 GET_BUNDLE_WITH_ALL_SIZE = 0x00000000, 121 GET_BUNDLE_WITHOUT_INSTALL_SIZE = 0x00000001, 122 GET_BUNDLE_WITHOUT_DATA_SIZE = 0x00000002, 123 GET_BUNDLE_WITHOUT_CACHE_SIZE = 0x00000004, 124 }; 125 126 constexpr const char* ACTION_HOME = "action.system.home"; 127 constexpr const char* WANT_ACTION_HOME = "ohos.want.action.home"; 128 constexpr const char* ENTITY_HOME = "entity.system.home"; 129 130 constexpr uint8_t MAX_BUNDLE_NAME = 128; 131 constexpr uint8_t MIN_BUNDLE_NAME = 7; 132 constexpr uint8_t MAX_JSON_ELEMENT_LENGTH = 255; 133 constexpr uint16_t MAX_JSON_ARRAY_LENGTH = 1024; 134 135 constexpr uint16_t MAX_JSON_STRING_LENGTH = 4096; 136 constexpr const char* UID = "uid"; 137 constexpr const char* USER_ID = "userId"; 138 constexpr const char* BUNDLE_NAME = "bundleName"; 139 constexpr const char* MODULE_NAME = "moduleName"; 140 constexpr const char* ABILITY_NAME = "abilityName"; 141 constexpr const char* HAP_PATH = "hapPath"; 142 constexpr const char* APP_INDEX = "appIndex"; 143 constexpr int8_t MAX_LIMIT_SIZE = 4; 144 145 constexpr const char* PARAM_URI_SEPARATOR = ":///"; 146 constexpr uint8_t PARAM_URI_SEPARATOR_LEN = 4; 147 constexpr const char* URI_SEPARATOR = "://"; 148 149 // ipc 150 constexpr int32_t CAPACITY_SIZE = 1 * 1024 * 1000; // 1M 151 constexpr int32_t MAX_PARCEL_CAPACITY = 100 * 1024 * 1024; // 100M 152 153 // permission 154 constexpr const char* LISTEN_BUNDLE_CHANGE = "ohos.permission.LISTEN_BUNDLE_CHANGE"; 155 156 // sandbox application 157 constexpr const char* SANDBOX_APP_INDEX = "sandbox_app_index"; 158 constexpr int16_t INITIAL_APP_INDEX = 0; 159 constexpr int16_t INITIAL_SANDBOX_APP_INDEX = 1000; 160 constexpr int16_t MAX_APP_INDEX = 100; 161 constexpr int16_t MAX_SANDBOX_APP_INDEX = INITIAL_SANDBOX_APP_INDEX + 100; 162 163 // app-distribution-type 164 constexpr const char* APP_DISTRIBUTION_TYPE_NONE = "none"; 165 constexpr const char* APP_DISTRIBUTION_TYPE_APP_GALLERY = "app_gallery"; 166 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE = "enterprise"; 167 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_NORMAL = "enterprise_normal"; 168 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_MDM = "enterprise_mdm"; 169 constexpr const char* APP_DISTRIBUTION_TYPE_INTERNALTESTING = "internaltesting"; 170 constexpr const char* APP_DISTRIBUTION_TYPE_OS_INTEGRATION = "os_integration"; 171 constexpr const char* APP_DISTRIBUTION_TYPE_CROWDTESTING = "crowdtesting"; 172 // app provision type 173 constexpr const char* APP_PROVISION_TYPE_DEBUG = "debug"; 174 constexpr const char* APP_PROVISION_TYPE_RELEASE = "release"; 175 constexpr const char* APP_PROVISION_TYPE_FILE_NAME = "debug_type"; 176 constexpr const char* DEBUG_TYPE_VALUE = "3"; 177 constexpr const char* RELEASE_TYPE_VALUE = "2"; 178 // crowdtesting 179 constexpr int8_t INVALID_CROWDTEST_DEADLINE = -1; 180 constexpr int8_t INHERIT_CROWDTEST_DEADLINE = -2; 181 182 // overlay installation 183 constexpr const char* OVERLAY_STATE = "overlayState"; 184 constexpr const char* PERMISSION_CHANGE_OVERLAY_ENABLED_STATE = "ohos.permission.CHANGE_OVERLAY_ENABLED_STATE"; 185 186 constexpr const char* SCENE_BOARD_BUNDLE_NAME = "com.ohos.sceneboard"; 187 188 // clone application 189 constexpr int32_t MAIN_APP_INDEX = 0; 190 constexpr int32_t CLONE_APP_INDEX_MAX = 5; 191 192 //param key-value 193 constexpr const char* VERIFY_UNINSTALL_FORCED_KEY = "ohos.bms.param.verifyUninstallForced"; 194 constexpr const char* VERIFY_UNINSTALL_FORCED_VALUE = "true"; 195 196 constexpr const char* VERIFY_UNINSTALL_RULE_KEY = "ohos.bms.param.verifyUninstallRule"; 197 constexpr const char* VERIFY_UNINSTALL_RULE_VALUE = "true"; 198 199 constexpr const char* SUPPORT_APP_TYPES_SEPARATOR = ","; 200 constexpr const char* APP_DISTRIBUTION_TYPE_WHITE_LIST = "appDistributionTypeWhiteList"; 201 202 constexpr const char* ARKTS_MODE = "arkTSMode"; 203 constexpr const char* MODULE_ARKTS_MODE = "moduleArkTSMode"; 204 constexpr const char* ARKTS_MODE_DYNAMIC = "dynamic"; 205 constexpr const char* ARKTS_MODE_STATIC = "static"; 206 constexpr const char* ARKTS_MODE_HYBRID = "hybrid"; 207 208 inline constexpr const char* NAME = "name"; 209 inline constexpr const char* SRC_ENTRANCE = "srcEntrance"; 210 inline constexpr const char* ICON = "icon"; 211 inline constexpr const char* ICON_ID = "iconId"; 212 inline constexpr const char* LABEL = "label"; 213 inline constexpr const char* LABEL_ID = "labelId"; 214 inline constexpr const char* DESCRIPTION = "description"; 215 inline constexpr const char* DESCRIPTION_ID = "descriptionId"; 216 inline constexpr const char* PRIORITY = "priority"; 217 inline constexpr const char* TYPE = "type"; 218 inline constexpr const char* EXTENSION_TYPE_NAME = "extensionTypeName"; 219 inline constexpr const char* PERMISSIONS = "permissions"; 220 inline constexpr const char* APPIDENTIFIER_ALLOW_LIST = "appIdentifierAllowList"; 221 inline constexpr const char* READ_PERMISSION = "readPermission"; 222 inline constexpr const char* WRITE_PERMISSION = "writePermission"; 223 inline constexpr const char* URI = "uri"; 224 inline constexpr const char* VISIBLE = "visible"; 225 inline constexpr const char* META_DATA = "metadata"; 226 inline constexpr const char* RESOURCE_PATH = "resourcePath"; 227 inline constexpr const char* ENABLED = "enabled"; 228 inline constexpr const char* PROCESS = "process"; 229 inline constexpr const char* COMPILE_MODE = "compileMode"; 230 inline constexpr const char* EXTENSION_PROCESS_MODE = "extensionProcessMode"; 231 inline constexpr const char* SKILLS = "skills"; 232 inline constexpr const char* NEED_CREATE_SANDBOX = "needCreateSandbox"; 233 inline constexpr const char* DATA_GROUP_IDS = "dataGroupIds"; 234 inline constexpr const char* VALID_DATA_GROUP_IDS = "validDataGroupIds"; 235 inline constexpr const char* CUSTOM_PROCESS = "customProcess"; 236 inline constexpr const char* ISOLATION_PROCESS = "isolationProcess"; 237 inline constexpr const char* SRC_LANGUAGE_JS = "js"; 238 inline constexpr const char* PREFER_MULTI_WINDOW_ORIENTATION_DEFAULT = "default"; 239 } // namespace Constants 240 } // namespace AppExecFwk 241 } // namespace OHOS 242 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H