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 OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_ERRORS_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_ERRORS_H 18 19 #include <map> 20 21 #include "errors.h" 22 23 namespace OHOS { 24 namespace AAFwk { 25 enum { 26 /** 27 * Module type: Ability Manager Service side 28 */ 29 ABILITY_MODULE_TYPE_SERVICE = 0, 30 /** 31 * Module type: ABility Kit side 32 */ 33 ABILITY_MODULE_TYPE_KIT = 1, 34 /** 35 * Module type: Ability connection state kit side 36 */ 37 ABILITY_MODULE_TYPE_CONNECTION_STATE_KIT = 2 38 }; 39 40 // offset of aafwk error, only be used in this file. 41 constexpr ErrCode AAFWK_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_AAFWK, ABILITY_MODULE_TYPE_SERVICE); 42 43 enum { 44 /** 45 * Result(2097152) for StartAbility: An error of the Want could not be resolved 46 * to ability info from BMS or DistributedMS. 47 */ 48 RESOLVE_ABILITY_ERR = AAFWK_SERVICE_ERR_OFFSET, 49 /** 50 * Result(2097153) for Connect: An error of the get ability service. 51 */ 52 GET_ABILITY_SERVICE_FAILED, 53 /** 54 * Result(2097154) for Connect State: An error of the the ability service not connect. 55 */ 56 ABILITY_SERVICE_NOT_CONNECTED, 57 /** 58 * Result(2097155) for StartAbility: An error of the Want could not be resolved 59 * to app info from BMS or DistributedMS. 60 */ 61 RESOLVE_APP_ERR, 62 /** 63 * Result(2097156) for StartAbility: The ability to start is already at the top. 64 */ 65 ABILITY_EXISTED, 66 /** 67 * Result(2097157) for StartAbility: An error to create mission stack. 68 */ 69 CREATE_MISSION_STACK_FAILED, 70 /** 71 * Result(2097158) for StartAbility: An error to create ability record. 72 */ 73 CREATE_ABILITY_RECORD_FAILED, 74 /** 75 * Result(2097159) for StartAbility: The ability to start is waiting. 76 */ 77 START_ABILITY_WAITING, 78 /** 79 * Result(2097160) for TerminateAbility: Don't allow to terminate launcher. 80 */ 81 TERMINATE_LAUNCHER_DENIED, 82 /** 83 * Result(2097161) for DisconnectAbility: Connection not exist. 84 */ 85 CONNECTION_NOT_EXIST, 86 /** 87 * Result(2097162) for DisconnectAbility:Connection is invalid state. 88 */ 89 INVALID_CONNECTION_STATE, 90 /** 91 * Result(2097163) for LoadctAbility:LoadAbility timeout. 92 */ 93 LOAD_ABILITY_TIMEOUT, 94 /** 95 * Result(2097164) for DisconnectAbility:Connection timeout. 96 */ 97 CONNECTION_TIMEOUT, 98 /** 99 * Result(2097165) for start service: An error of the get BundleManagerService. 100 */ 101 GET_BUNDLE_MANAGER_SERVICE_FAILED, 102 /** 103 * Result(2097166) for Remove mission: An error of removing mission. 104 */ 105 REMOVE_MISSION_FAILED, 106 /** 107 * Result(2097167) for All: An error occurs in server. 108 */ 109 INNER_ERR, 110 /** 111 * Result(2097168) for Get recent mission: get recent missions failed 112 */ 113 GET_RECENT_MISSIONS_FAILED, 114 /** 115 * Result(2097169) for Remove stack: Don't allow to remove stack which has launcher ability. 116 */ 117 REMOVE_STACK_LAUNCHER_DENIED, 118 /** 119 * Result(2097170) for ConnectAbility:target ability is not service ability. 120 */ 121 TARGET_ABILITY_NOT_SERVICE, 122 /** 123 * Result(2097171) for TerminateAbility:target service has a record of connect. It cannot be stopped. 124 */ 125 TERMINATE_SERVICE_IS_CONNECTED, 126 /** 127 * Result(2097172) for StartAbility:The ability to start is already activating.. 128 */ 129 START_SERVICE_ABILITY_ACTIVATING, 130 /** 131 * Result(2097173) for move mission to top: An error of moving stack. 132 */ 133 MOVE_MISSION_FAILED, 134 /** 135 * Result(2097174) for kill process: An error of kill process. 136 */ 137 KILL_PROCESS_FAILED, 138 /** 139 * Result(2097175) for uninstall app: An error of uninstall app. 140 */ 141 UNINSTALL_APP_FAILED, 142 /** 143 * Result(2097176) for terminate ability result: An error of terminate service. 144 */ 145 TERMINATE_ABILITY_RESULT_FAILED, 146 /** 147 * Result(2097177) for check permission failed. 148 */ 149 CHECK_PERMISSION_FAILED, 150 151 /** 152 * Result(2097178) for no found abilityrecord by caller 153 */ 154 NO_FOUND_ABILITY_BY_CALLER, 155 156 /** 157 * Result(2097179) for ability visible attribute is false. 158 */ 159 ABILITY_VISIBLE_FALSE_DENY_REQUEST, 160 161 /** 162 * Result(2097180) for caller is not systemapp. 163 */ 164 CALLER_ISNOT_SYSTEMAPP, 165 166 /** 167 * Result(2097181) for get bundleName by uid fail. 168 */ 169 GET_BUNDLENAME_BY_UID_FAIL, 170 171 /** 172 * Result(2097182) for mission not found. 173 */ 174 MISSION_NOT_FOUND, 175 176 /** 177 * Result(2097183) for get bundle info fail. 178 */ 179 GET_BUNDLE_INFO_FAILED, 180 181 /** 182 * Result(2097184) for KillProcess: keep alive process can not be killed 183 */ 184 KILL_PROCESS_KEEP_ALIVE, 185 186 /** 187 * Result(2097185) for clear the application data fail. 188 */ 189 CLEAR_APPLICATION_DATA_FAIL, 190 191 // for call ability 192 /** 193 * Result(2097186) for resolve ability failed, there is no permissions 194 */ 195 RESOLVE_CALL_NO_PERMISSIONS, 196 197 /** 198 * Result(2097187) for resolve ability failed, target ability not page or singleton 199 */ 200 RESOLVE_CALL_ABILITY_TYPE_ERR, 201 202 /** 203 * Result(2097188) for resolve ability failed, resolve failed. 204 */ 205 RESOLVE_CALL_ABILITY_INNER_ERR, 206 207 /** 208 * Result(2097189) for resolve ability failed, resolve failed. 209 */ 210 RESOLVE_CALL_ABILITY_VERSION_ERR, 211 212 /** 213 * Result(2097190) for release ability failed, release failed. 214 */ 215 RELEASE_CALL_ABILITY_INNER_ERR, 216 217 /** 218 * Result(2097191) for register remote mission listener fail. 219 */ 220 REGISTER_REMOTE_MISSION_LISTENER_FAIL, 221 222 /** 223 * Result(2097192) for unregister remote mission listener fail. 224 */ 225 UNREGISTER_REMOTE_MISSION_LISTENER_FAIL, 226 227 /** 228 * Result(2097193) for invalid userid. 229 */ 230 INVALID_USERID_VALUE, 231 232 /** 233 * Result(2097194) for start user test fail. 234 */ 235 START_USER_TEST_FAIL, 236 237 /** 238 * Result(2097195) for send usr1 sig to the process of not response fail. 239 */ 240 SEND_USR1_SIG_FAIL, 241 242 /** 243 * Result(2097196) for hidump fail. 244 */ 245 ERR_AAFWK_HIDUMP_ERROR, 246 247 /** 248 * Result(2097197) for hidump params are invalid. 249 */ 250 ERR_AAFWK_HIDUMP_INVALID_ARGS, 251 252 /** 253 * Result(2097198) for parcel fail. 254 */ 255 ERR_AAFWK_PARCEL_FAIL, 256 257 /** 258 * Result(2097199) for for implicit start ability is failed. 259 */ 260 ERR_IMPLICIT_START_ABILITY_FAIL, 261 262 /** 263 * Result(2097200) for instance reach to upper limit. 264 */ 265 ERR_REACH_UPPER_LIMIT, 266 267 /** 268 * Result(2097201) for window mode. 269 */ 270 ERR_AAFWK_INVALID_WINDOW_MODE, 271 272 /** 273 * Result(2097202) for wrong interface call. 274 */ 275 ERR_WRONG_INTERFACE_CALL, 276 277 /** 278 * Result(2097203) for crowdtest expired. 279 */ 280 ERR_CROWDTEST_EXPIRED, 281 282 /** 283 * Result(2097204) for application abnormal. 284 */ 285 ERR_DISPOSED_STATUS, 286 287 /** 288 * Result(2097205) for invalid caller. 289 */ 290 ERR_INVALID_CALLER, 291 292 /** 293 * Result(2097206) for not allowed continuation flag. 294 */ 295 ERR_INVALID_CONTINUATION_FLAG, 296 297 /** 298 * Result(2097207) for not allowed to cross user. 299 */ 300 ERR_CROSS_USER, 301 302 /** 303 * Result(2097208) for not granted for static permission. 304 */ 305 ERR_STATIC_CFG_PERMISSION, 306 }; 307 308 enum { 309 /** 310 * Provides a list that does not contain any 311 * recent missions that currently are not available to the user. 312 */ 313 RECENT_IGNORE_UNAVAILABLE = 0x0002, 314 }; 315 316 enum NativeFreeInstallError { 317 FREE_INSTALL_OK = 0, 318 /** 319 * FA search failed. 320 */ 321 FA_FREE_INSTALL_QUERY_ERROR = -1, 322 323 /** 324 * HAG query timeout. 325 */ 326 HAG_QUERY_TIMEOUT = -4, 327 328 /** 329 * FA Network unavailable. 330 */ 331 FA_NETWORK_UNAVAILABLE = -2, 332 333 /** 334 * FA internal system error. 335 */ 336 FA_FREE_INSTALL_SERVICE_ERROR = 0x820101, 337 338 /** 339 * FA distribution center crash. 340 */ 341 FA_CRASH = 0x820102, 342 343 /** 344 * FA distribution center processing timeout(30s). 345 */ 346 FA_TIMEOUT = 0x820103, 347 348 /** 349 * BMS unknown exception. 350 */ 351 UNKNOWN_EXCEPTION = 0x820104, 352 353 /** 354 * It is not supported to pull up PA across applications on the same device 355 */ 356 NOT_SUPPORT_PA_ON_SAME_DEVICE = -11, 357 358 /** 359 * FA internal system error. 360 */ 361 FA_INTERNET_ERROR = -3, 362 363 /** 364 * The user confirms to jump to the application market upgrade. 365 */ 366 JUMP_TO_THE_APPLICATION_MARKET_UPGRADE = -8, 367 368 /** 369 * User gives up. 370 */ 371 USER_GIVES_UP = -7, 372 373 /** 374 * Installation error in free installation. 375 */ 376 INSTALLATION_ERROR_IN_FREE_INSTALL = -5, 377 378 /** 379 * HAP package download timed out. 380 */ 381 HAP_PACKAGE_DOWNLOAD_TIMED_OUT = -9, 382 383 /** 384 * There are concurrent tasks, waiting for retry. 385 */ 386 CONCURRENT_TASKS_WAITING_FOR_RETRY = -6, 387 388 /** 389 * FA package does not support free installation. 390 */ 391 FA_PACKAGE_DOES_NOT_SUPPORT_FREE_INSTALL = -10, 392 393 /** 394 * The app is not allowed to pull this FA. 395 */ 396 NOT_ALLOWED_TO_PULL_THIS_FA = -901, 397 398 /** 399 * Not support cross-device free install PA 400 */ 401 NOT_SUPPORT_CROSS_DEVICE_FREE_INSTALL_PA = -12, 402 403 /** 404 * Free install timeout 405 */ 406 FREE_INSTALL_TIMEOUT = 29360300, 407 408 /** 409 * Not top ability 410 */ 411 NOT_TOP_ABILITY = 0x500001, 412 413 /** 414 * Target bundle name is not exist in targetBundleList. 415 */ 416 TARGET_BUNDLE_NOT_EXIST = 0x500002, 417 418 /** 419 * Permission denied. 420 */ 421 DMS_PERMISSION_DENIED = 29360157, 422 423 /** 424 * Result(29360176) for component access permission check failed. 425 */ 426 DMS_COMPONENT_ACCESS_PERMISSION_DENIED = 29360176, 427 428 /** 429 * Invalid parameters. 430 */ 431 INVALID_PARAMETERS_ERR = 29360128, 432 433 /** 434 * Remote DMS is not compatible. 435 */ 436 REMOTE_DEVICE_NOT_COMPATIBLE = 502, 437 438 /** 439 * Remote service's device is offline. 440 */ 441 DEVICE_OFFLINE_ERR = 29360142, 442 443 /** 444 * Result(29360175) for account access permission check failed. 445 */ 446 DMS_ACCOUNT_ACCESS_PERMISSION_DENIED = 29360175, 447 448 /** 449 * Result(29360131) for remote invalid parameters. 450 */ 451 INVALID_REMOTE_PARAMETERS_ERR = 29360131, 452 453 /* 454 * Result(29360205) for continue freeinstall failed. 455 */ 456 CONTINUE_FREE_INSTALL_FAILED = 29360205, 457 458 /** 459 * Undefine error code. 460 */ 461 UNDEFINE_ERROR_CODE = 3, 462 }; 463 464 static const std::map<NativeFreeInstallError, std::string> FIErrorStrs = { 465 { 466 FREE_INSTALL_OK, 467 "Free install ok." 468 }, 469 { 470 FA_FREE_INSTALL_QUERY_ERROR, 471 "FA search failed" 472 }, 473 { 474 HAG_QUERY_TIMEOUT, 475 "HAG query timeout." 476 }, 477 { 478 FA_NETWORK_UNAVAILABLE, 479 "FA Network unavailable." 480 }, 481 { 482 FA_FREE_INSTALL_SERVICE_ERROR, 483 "FA internal system error." 484 }, 485 { 486 FA_CRASH, 487 "FA distribution center crash." 488 }, 489 { 490 FA_TIMEOUT, 491 "FA distribution center processing timeout." 492 }, 493 { 494 UNKNOWN_EXCEPTION, 495 "Unknown exception." 496 }, 497 { 498 NOT_SUPPORT_PA_ON_SAME_DEVICE, 499 "It is not supported to pull up PA across applications on the same device." 500 }, 501 { 502 FA_INTERNET_ERROR, 503 "FA internal system error." 504 }, 505 { 506 JUMP_TO_THE_APPLICATION_MARKET_UPGRADE, 507 "The user confirms to jump to the application market upgrade." 508 }, 509 { 510 USER_GIVES_UP, 511 "User gives up." 512 }, 513 { 514 INSTALLATION_ERROR_IN_FREE_INSTALL, 515 "Installation error in free installation." 516 }, 517 { 518 HAP_PACKAGE_DOWNLOAD_TIMED_OUT, 519 "HAP package download timed out." 520 }, 521 { 522 CONCURRENT_TASKS_WAITING_FOR_RETRY, 523 "There are concurrent tasks, waiting for retry." 524 }, 525 { 526 FA_PACKAGE_DOES_NOT_SUPPORT_FREE_INSTALL, 527 "FA package does not support free installation." 528 }, 529 { 530 NOT_ALLOWED_TO_PULL_THIS_FA, 531 "The app is not allowed to pull this FA." 532 }, 533 { 534 NOT_SUPPORT_CROSS_DEVICE_FREE_INSTALL_PA, 535 "Not support cross-device free install PA." 536 }, 537 { 538 DMS_PERMISSION_DENIED, 539 "Permission denied." 540 }, 541 { 542 DMS_COMPONENT_ACCESS_PERMISSION_DENIED, 543 "Component access permission denied." 544 }, 545 { 546 DMS_ACCOUNT_ACCESS_PERMISSION_DENIED, 547 "Component access permission denied." 548 }, 549 { 550 INVALID_PARAMETERS_ERR, 551 "Invalid parameters." 552 }, 553 { 554 INVALID_REMOTE_PARAMETERS_ERR, 555 "Invalid parameters." 556 }, 557 { 558 REMOTE_DEVICE_NOT_COMPATIBLE, 559 "Remote DMS is not compatible." 560 }, 561 { 562 DEVICE_OFFLINE_ERR, 563 "Remote service's device is offline." 564 }, 565 { 566 FREE_INSTALL_TIMEOUT, 567 "Free install timeout." 568 }, 569 { 570 NOT_TOP_ABILITY, 571 "Not top ability" 572 }, 573 { 574 TARGET_BUNDLE_NOT_EXIST, 575 "Target bundle name is not exist in targetBundleList." 576 }, 577 { 578 CONTINUE_FREE_INSTALL_FAILED, 579 "Error continue freeinstall failed." 580 }, 581 }; 582 } // namespace AAFwk 583 } // namespace OHOS 584 #endif // OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_ERRORS_H 585