1 /* 2 * Copyright (c) 2020-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 /** 17 * @addtogroup BundleManager 18 * @{ 19 * 20 * @brief Provides structures and functions for managing application bundles and obtaining application information. 21 * 22 * You can use functions provided by this module to install, update, or uninstall an application, obtain 23 * {@link AbilityInfo} and {@link BundleInfo} about an application, and obtain the bundle name of an application 24 * based on the application's user ID (UID). 25 * 26 * @since 1.0 27 * @version 1.0 28 */ 29 30 /** 31 * @file appexecfwk_errors.h 32 * 33 * @brief Declares error codes returned by bundle management functions. 34 * 35 * @since 1.0 36 * @version 1.0 37 */ 38 #ifndef OHOS_APPEXECFWK_ERRORS_H 39 #define OHOS_APPEXECFWK_ERRORS_H 40 41 /** 42 * @brief Enumerates error codes provided by the Bundle Manager Service. 43 */ 44 enum AppexecfwkErrors { 45 /** The function is successfully called. */ 46 ERR_OK = 0, 47 48 /** Incorrect parameter for querying {@link AbilityInfo} or {@link BundleInfo}. */ 49 ERR_APPEXECFWK_QUERY_PARAMETER_ERROR, 50 51 /** No {@link AbilityInfo} or {@link BundleInfo} is found. */ 52 ERR_APPEXECFWK_QUERY_NO_INFOS, 53 54 /** An error occurred when initializing {@link BundleInfo} or {@link AbilityInfo} during information query. */ 55 ERR_APPEXECFWK_QUERY_INFOS_INIT_ERROR, 56 57 /** The object or pointer is null. */ 58 ERR_APPEXECFWK_OBJECT_NULL, 59 60 /** Failed to install the application due to an internal logic error. */ 61 ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR = 10, 62 63 /** Failed to install the application due to incorrect parameters. */ 64 ERR_APPEXECFWK_INSTALL_FAILED_PARAM_ERROR, 65 66 /** Failed to install the application because the installation file path is invalid. */ 67 ERR_APPEXECFWK_INSTALL_FAILED_FILE_PATH_INVALID, 68 69 /** Failed to install the application because the installation file does not exist. */ 70 ERR_APPEXECFWK_INSTALL_FAILED_FILE_NOT_EXISTS, 71 72 /** Failed to install the application because the installation file name is invalid. */ 73 ERR_APPEXECFWK_INSTALL_FAILED_INVALID_FILE_NAME, 74 75 /** Failed to install the application due to incorrect file content. */ 76 ERR_APPEXECFWK_INSTALL_FAILED_BAD_FILE, 77 78 /** Failed to install the application due to a file creation error. */ 79 ERR_APPEXECFWK_INSTALL_FAILED_CREATE_FILE_ERROR, 80 81 /** Failed to install the application because an error occurred when creating the permission file directory. */ 82 ERR_APPEXECFWK_INSTALL_FAILED_CREATE_PERMISSIONS_DIR_ERROR, 83 84 /** Failed to install the application due to a path renaming error. */ 85 ERR_APPEXECFWK_INSTALL_FAILED_RENAME_DIR_ERROR, 86 /** Failed to install the application due to a file renaming error. */ 87 ERR_APPEXECFWK_INSTALL_FAILED_RENAME_FILE_ERROR, 88 89 /** Failed to install the application due to an error occurred when creating the data path. */ 90 ERR_APPEXECFWK_INSTALL_FAILED_CREATE_DATA_DIR_ERROR, 91 92 /** Failed to install the application due to an error occurred when recording installation information. */ 93 ERR_APPEXECFWK_INSTALL_FAILED_RECORD_INFO_ERROR, 94 95 /** Failed to install the application due to an error occurred when backing up the UID and GID. */ 96 ERR_APPEXECFWK_INSTALL_FAILED_UID_AND_GID_BACKUP_ERROR, 97 98 /** Failed to install the application because an application of a later version has been installed. */ 99 ERR_APPEXECFWK_INSTALL_FAILED_VERSION_DOWNGRADE, 100 101 /** 102 * Failed to install the application because the number of installed applications exceeds the maximum (30). This 103 * error code is available only to basic watches. 104 */ 105 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_BUNDLE_NUMBER, 106 107 /** Failed to install the application due to an error occurred when storing permission information. */ 108 ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR, 109 110 /** 111 * Failed to install the application due to invalid file data. This error code is available only to basic 112 * watches. 113 */ 114 ERR_APPEXECFWK_INSTALL_FAILED_FILE_DATA_INVALID, 115 116 /** Failed to install the application due to unmatched signature used for version update. */ 117 ERR_APPEXECFWK_INSTALL_FAILED_INCOMPATIBLE_SIGNATURE, 118 119 /** Failed to install the application due to unmatched provisioning information during signature verification. */ 120 ERR_APPEXECFWK_INSTALL_FAILED_INVALID_PROVISIONINFO, 121 122 /** Failed to install the application due to an error occurred when processing the signature file. */ 123 ERR_APPEXECFWK_INSTALL_FAILED_OPERATE_SIGNED_FILE_ERROR, 124 125 /** Failed to install the application due to an error occurred when parsing the application signature. */ 126 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_APP_SIGNATURE_ERROR, 127 128 /** Failed to install the application due to an error occurred when parsing the file signature. */ 129 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_PROFILE_SIGNATURE_ERROR, 130 131 /** Failed to install the application due to an internal error during signature verification. */ 132 ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_SIGNATURE_ERROR, 133 134 ERR_APPEXECFWK_INSTALL_FAILED_GET_JS_ENGINE_VERSION_ERROR, 135 136 ERR_APPEXECFWK_INSTALL_FAILED_TRANSFORM_BC_FILE_ERROR, 137 138 /** Failed to install the application due to an error occurred when setting the signature verification mode. */ 139 ERR_APPEXECFWK_SET_DEBUG_MODE_ERROR, 140 141 /** Failed to parse the file. */ 142 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_PROFILE_ERROR = 40, 143 144 /** Failed to parse the bundle name. */ 145 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_BUNDLENAME_ERROR, 146 147 /** Invalid bundle name. */ 148 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_INVALID_BUNDLENAME, 149 150 /** Failed to parse the vendor information. */ 151 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_VENDOR_ERROR, 152 153 /** Failed to parse the version code. */ 154 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_VERSIONCODE_ERROR, 155 156 /** Failed to parse the version name. */ 157 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_VERSIONNAME_ERROR, 158 159 /** Failed to parse the installation permission information. */ 160 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_PERMISSIONS_ERROR, 161 162 /** Failed to parse the API version. */ 163 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_API_VERSION_ERROR, 164 165 /** Failed to parse the device configuration. */ 166 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DEVICE_CONFIG_ERROR, 167 168 /** Failed to parse the <b>isKeepAlive</b> field of the application. */ 169 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_KEEPALIVE_ERROR, 170 171 /** 172 * Failed to parse the <b>name</b> field of the application's HAP package. The HAP information is encapsulated in 173 * a {@link ModuleInfo} object. 174 */ 175 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_MODULENAME_ERROR, 176 177 /** Invalid HAP name. */ 178 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_INVALID_MODULENAME, 179 180 /** Failed to parse the HAP description information. */ 181 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_MODULE_DESCRIPTION_ERROR, 182 183 /** Failed to parse the <b>deviceType</b> field of the application's HAP package. */ 184 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DEVICETYPE_ERROR, 185 186 /** Failed to parse the <b>deviceCapability</b> field of the application's HAP package. */ 187 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DEVICECAP_ERROR, 188 189 /** Failed to parse the HAP information. */ 190 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DISTRO_ERROR, 191 192 /** Failed to parse the <b>moduleName</b> field of the application's HAP package. */ 193 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DISTRO_MODULENAME_ERROR, 194 195 /** Invalid HAP type. */ 196 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DISTRO_MODULETYPE_ERROR, 197 198 /** Failed to parse the <b>isDeliveryInstall</b> field of the application's HAP package. */ 199 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DISTRO_DELIVERY_ERROR, 200 201 /** Failed to parse the {@link MetaData} information. */ 202 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_METADATA_ERROR, 203 204 /** Failed to parse the {@link AbilityInfo}. */ 205 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITIES_ERROR = 60, 206 207 /** Failed to parse the class name of the ability. */ 208 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_NAME_ERROR, 209 210 /** Failed to parse the template used by the ability. */ 211 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_TYPE_ERROR, 212 213 /** Failed to parse the icon path of the ability. */ 214 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_ICONPATH_ERROR, 215 216 /** Failed to parse the label of the ability. */ 217 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_LABEL_ERROR, 218 219 /** Failed to parse the description of the ability. */ 220 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_DESCRIPTION_ERROR, 221 222 /** Failed to parse the startup mode of the ability. */ 223 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_LAUNCHTYPE_ERROR, 224 225 /** Failed to parse the <b>isVisible</b> field of the ability. */ 226 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_VISIBLE_ERROR, 227 228 /** Invalid length of the bundle name. */ 229 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_INVALID_BUNDLENAME_LENGTH, 230 231 /** The parsed application label exceeds the maximum length (255 bytes). */ 232 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_LABEL_LENGTH_ERROR, 233 234 /** The parsed application version name exceeds the maximum length (127 bytes). */ 235 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_VERSIONNAME_LENGTH_ERROR = 70, 236 237 /** The parsed application metadata name exceeds the maximum length (255 bytes). */ 238 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_METADATA_NAME_LENGTH_ERROR, 239 240 /** The parsed application metadata value exceeds the maximum length (255 bytes). */ 241 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_METADATA_VALUE_LENGTH_ERROR, 242 243 /** The parsed application vendor name exceeds the maximum length (255 bytes). */ 244 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_VENDOR_LENGTH_ERROR, 245 246 /** The parsed HAP name exceeds the maximum length (31 bytes). */ 247 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_MODULENAME_LENGTH_ERROR, 248 249 /** The parsed ability class name exceeds the maximum length (127 bytes). */ 250 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_ABILITYNAME_LENGTH_ERROR, 251 252 /** The parsed ability description exceeds the maximum length (255 bytes). */ 253 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_ABILITY_DESCRIPTION_LENGTH_ERROR, 254 255 /** The parsed ability label exceeds the maximum length (255 bytes). */ 256 ERR_APPEXECFWK_INSTALL_FAILED_EXCEED_MAX_ABILITY_LABEL_LENGTH_ERROR, 257 258 /** Failed to initialize the extractor. */ 259 ERR_APPEXECFWK_INSTALL_FAILED_EXTRACTOR_NOT_INIT, 260 261 /** Failed to extract information from the HAP package. */ 262 ERR_APPEXECFWK_INSTALL_FAILED_EXTRACT_HAP_ERROR, 263 264 /** Failed to parse the JavaScript path. This error code is available only to basic watches. */ 265 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_JS_DIR_ERROR = 80, 266 267 /** The resource index does not exist. */ 268 ERR_APPEXECFWK_INSTALL_FAILED_RESOURCE_INDEX_NOT_EXISTS, 269 270 /** Failed to parse the label resource. */ 271 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_LABEL_RES_ERROR, 272 273 /** Failed to parse the icon resource. */ 274 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ICON_RES_ERROR, 275 276 /** Failed to parse the description resource. */ 277 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_DESCRIPTION_RES_ERROR, 278 279 /** Failed to install the application due to a request sending error. */ 280 ERR_APPEXECFWK_INSTALL_FAILED_SEND_REQUEST_ERROR, 281 282 /** Failed to parse the ability skill*/ 283 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_SKILLS_ERROR, 284 285 /** Failed to uninstall the application due to an internal error. */ 286 ERR_APPEXECFWK_UNINSTALL_FAILED_INTERNAL_ERROR = 90, 287 288 /** Failed to uninstall the application due to incorrect input parameters. */ 289 ERR_APPEXECFWK_UNINSTALL_FAILED_PARAM_ERROR, 290 291 /** Failed to uninstall the application because it does not exist. */ 292 ERR_APPEXECFWK_UNINSTALL_FAILED_BUNDLE_NOT_EXISTS, 293 294 /** Failed to uninstall the application due to an error occurred when deleting the path. */ 295 ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_DIRS_ERROR, 296 297 /** Failed to uninstall the application due to an error occurred when deleting the installation record. */ 298 ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_RECORD_INFO_ERROR, 299 300 /** Failed to uninstall the application due to an error occurred when deleting the permission information. */ 301 ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_PERMISSIONS_ERROR, 302 303 /** Failed to uninstall the application because the application cannot be uninstalled. */ 304 ERR_APPEXECFWK_UNINSTALL_FAILED_BUNDLE_NOT_UNINSTALLABLE, 305 306 /** Failed to uninstall the application due to an error occurred when deleting the UID information. */ 307 ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_UID_INFO_ERROR, 308 309 /** Failed to uninstall the application due to a request sending error. */ 310 ERR_APPEXECFWK_UNINSTALL_FAILED_SEND_REQUEST_ERROR, 311 312 /** Incorrect dump information. */ 313 ERR_APPEXECFWK_DUMP_ERROR = 100, 314 315 /** Incorrect command. */ 316 ERR_APPEXECFWK_COMMAND_ERROR, 317 318 /** Failed to register the callback. */ 319 ERR_APPEXECFWK_CALLBACK_REGISTER_FAILED, 320 321 /** Failed to unregister the callback. */ 322 ERR_APPEXECFWK_CALLBACK_UNREGISTER_FAILED, 323 324 /** Failed to generate a service ID for the current process. */ 325 ERR_APPEXECFWK_CALLBACK_GENERATE_LOCAL_SERVICEID_FAILED, 326 327 /** Failed to transmit the service ID of the current process. */ 328 ERR_APPEXECFWK_CALLBACK_SERVICEID_TRANSMITTED_FAILED, 329 330 /** The callback is never registered. */ 331 ERR_APPEXECFWK_CALLBACK_NEVER_REGISTERED, 332 333 /** Failed to obtain the bundle names of all applications in the system. */ 334 ERR_APPEXECFWK_CALLBACK_OBTAIN_ALL_BUNDLE_FAILED, 335 336 /** The required callback is unavailable. */ 337 ERR_APPEXECFWK_CALLBACK_NULL_CORRESPONDING_CALLBACK, 338 339 /** Failed to obtain the installation type (installation or uninstallation). */ 340 ERR_APPEXECFWK_CALLBACK_GET_INSTALLTYPE_FAILED, 341 342 /** Incorrect installation type. */ 343 ERR_APPEXECFWK_CALLBACK_GET_ERROR_INSTALLTYPE, 344 345 /** Serialization failed. */ 346 ERR_APPEXECFWK_SERIALIZATION_FAILED, 347 348 /** Deserialization failed. */ 349 ERR_APPEXECFWK_DESERIALIZATION_FAILED, 350 351 /** Internal system error. */ 352 ERR_APPEXECFWK_SYSTEM_INTERNAL_ERROR, 353 354 /** No bundle name associated with the UID is found. */ 355 ERR_APPEXECFWK_NO_BUNDLENAME_FOR_UID, 356 357 /** The {@link IpcIo} structure is unavailable. */ 358 ERR_APPEXECFWK_IPCIO_UNAVAILABLED, 359 360 /** An error occurred when calling the <b>invoke</b> function of the Bundle Manager Service. */ 361 ERR_APPEXECFWK_INVOKE_ERROR, 362 363 /** The server that invokes the Bundle Manager Service does not have required permission. */ 364 ERR_APPEXECFWK_PERMISSION_DENIED, 365 366 /** Failed to parse the source path of the ability. */ 367 ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_SRC_PATH_ERROR, 368 }; 369 #endif // OHOS_APPEXECFWK_ERRORS_H 370 /** @} */