1 /* 2 * Copyright (c) 2023-2024 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_INTERFACE_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_INTERFACE_H 18 19 #include <ipc_types.h> 20 #include <iremote_broker.h> 21 #include <list> 22 #include <vector> 23 24 #include "ability_connect_callback_interface.h" 25 #include "ability_manager_ipc_interface_code.h" 26 #include "ability_running_info.h" 27 #include "ability_scheduler_interface.h" 28 #include "ability_start_setting.h" 29 #include "ability_state.h" 30 #include "ability_state_data.h" 31 #include "app_debug_listener_interface.h" 32 #include "auto_startup_info.h" 33 #include "dms_continueInfo.h" 34 #include "exit_reason.h" 35 #include "extension_running_info.h" 36 #include "free_install_observer_interface.h" 37 #include "iability_controller.h" 38 #include "iability_manager_collaborator.h" 39 #include "iacquire_share_data_callback_interface.h" 40 #include "insight_intent_execute_param.h" 41 #include "insight_intent_execute_result.h" 42 #include "iprepare_terminate_callback_interface.h" 43 #include "mission_info.h" 44 #include "mission_listener_interface.h" 45 #include "mission_snapshot.h" 46 #include "remote_mission_listener_interface.h" 47 #include "remote_on_listener_interface.h" 48 #include "running_process_info.h" 49 #include "sender_info.h" 50 #include "snapshot.h" 51 #include "start_options.h" 52 #include "user_callback.h" 53 #include "system_memory_attr.h" 54 #include "ui_extension_ability_connect_info.h" 55 #include "ui_extension_host_info.h" 56 #include "ui_extension_session_info.h" 57 #include "ui_extension_window_command.h" 58 #include "uri.h" 59 #include "want.h" 60 #include "want_receiver_interface.h" 61 #include "want_sender_info.h" 62 #include "want_sender_interface.h" 63 #include "dialog_session_info.h" 64 #include "window_config.h" 65 #ifdef SUPPORT_GRAPHICS 66 #include "window_manager_service_handler.h" 67 #include "ability_first_frame_state_observer_interface.h" 68 #endif 69 70 namespace OHOS { 71 namespace AbilityRuntime { 72 class IStatusBarDelegate; 73 } 74 75 namespace AAFwk { 76 using AutoStartupInfo = AbilityRuntime::AutoStartupInfo; 77 using InsightIntentExecuteParam = AppExecFwk::InsightIntentExecuteParam; 78 using InsightIntentExecuteResult = AppExecFwk::InsightIntentExecuteResult; 79 using UIExtensionAbilityConnectInfo = AbilityRuntime::UIExtensionAbilityConnectInfo; 80 using UIExtensionHostInfo = AbilityRuntime::UIExtensionHostInfo; 81 using UIExtensionSessionInfo = AbilityRuntime::UIExtensionSessionInfo; 82 #ifdef SUPPORT_GRAPHICS 83 using IAbilityFirstFrameStateObserver = AppExecFwk::IAbilityFirstFrameStateObserver; 84 #endif 85 86 constexpr const char* ABILITY_MANAGER_SERVICE_NAME = "AbilityManagerService"; 87 const int DEFAULT_INVAL_VALUE = -1; 88 const int DELAY_LOCAL_FREE_INSTALL_TIMEOUT = 40000; 89 const int DELAY_REMOTE_FREE_INSTALL_TIMEOUT = 30000 + DELAY_LOCAL_FREE_INSTALL_TIMEOUT; 90 constexpr const char* FROM_REMOTE_KEY = "freeInstallFromRemote"; 91 /** 92 * @class IAbilityManager 93 * IAbilityManager interface is used to access ability manager services. 94 */ 95 class IAbilityManager : public OHOS::IRemoteBroker { 96 public: 97 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.AbilityManager") 98 99 /** 100 * StartSelfUIAbility with want, start self uiability only on 2-in-1 devices. 101 * 102 * @param want, the want of the ability to start. 103 * @return Returns ERR_OK on success, others on failure. 104 */ StartSelfUIAbility(const Want & want)105 virtual int StartSelfUIAbility(const Want &want) 106 { 107 return 0; 108 } 109 110 /** 111 * StartAbility with want, send want to ability manager service. 112 * 113 * @param want, the want of the ability to start. 114 * @param userId, Designation User ID. 115 * @param requestCode, Ability request code. 116 * @return Returns ERR_OK on success, others on failure. 117 */ 118 virtual int StartAbility( 119 const Want &want, 120 int32_t userId = DEFAULT_INVAL_VALUE, 121 int requestCode = DEFAULT_INVAL_VALUE) = 0; 122 123 /** 124 * StartAbility with want, send want to ability manager service. 125 * 126 * @param want, the want of the ability to start. 127 * @param callerToken, caller ability token. 128 * @param userId, Designation User ID. 129 * @param requestCode, Ability request code. 130 * @return Returns ERR_OK on success, others on failure. 131 */ 132 virtual int StartAbility( 133 const Want &want, 134 const sptr<IRemoteObject> &callerToken, 135 int32_t userId = DEFAULT_INVAL_VALUE, 136 int requestCode = DEFAULT_INVAL_VALUE) = 0; 137 138 /** 139 * StartAbilityWithSpecifyTokenId with want and specialId, send want to ability manager service. 140 * 141 * @param want, the want of the ability to start. 142 * @param callerToken, caller ability token. 143 * @param specialId the caller Id. 144 * @param userId, Designation User ID. 145 * @param requestCode, Ability request code. 146 * @return Returns ERR_OK on success, others on failure. 147 */ 148 virtual int StartAbilityWithSpecifyTokenId( 149 const Want &want, 150 const sptr<IRemoteObject> &callerToken, 151 uint32_t specifyTokenId, 152 int32_t userId = DEFAULT_INVAL_VALUE, 153 int requestCode = DEFAULT_INVAL_VALUE) = 0; 154 155 /** 156 * StartAbility by insight intent, send want to ability manager service. 157 * 158 * @param want Ability want. 159 * @param callerToken caller ability token. 160 * @param intentId insight intent id. 161 * @param userId userId of target ability. 162 * @return Returns ERR_OK on success, others on failure. 163 */ 164 virtual int32_t StartAbilityByInsightIntent( 165 const Want &want, 166 const sptr<IRemoteObject> &callerToken, 167 uint64_t intentId, 168 int32_t userId = DEFAULT_INVAL_VALUE) = 0; 169 170 /** 171 * Starts a new ability with specific start settings. 172 * 173 * @param want Indicates the ability to start. 174 * @param requestCode the resultCode of the ability to start. 175 * @param abilityStartSetting Indicates the setting ability used to start. 176 * @param userId, Designation User ID. 177 * @return Returns ERR_OK on success, others on failure. 178 */ 179 virtual int StartAbility( 180 const Want &want, 181 const AbilityStartSetting &abilityStartSetting, 182 const sptr<IRemoteObject> &callerToken, 183 int32_t userId = DEFAULT_INVAL_VALUE, 184 int requestCode = DEFAULT_INVAL_VALUE) = 0; 185 186 /** 187 * Starts a new ability with specific start options. 188 * 189 * @param want, the want of the ability to start. 190 * @param startOptions Indicates the options used to start. 191 * @param callerToken, caller ability token. 192 * @param userId, Designation User ID. 193 * @param requestCode the resultCode of the ability to start. 194 * @return Returns ERR_OK on success, others on failure. 195 */ 196 virtual int StartAbility( 197 const Want &want, 198 const StartOptions &startOptions, 199 const sptr<IRemoteObject> &callerToken, 200 int32_t userId = DEFAULT_INVAL_VALUE, 201 int requestCode = DEFAULT_INVAL_VALUE) = 0; 202 203 /** 204 * Starts a new ability using the original caller information. 205 * 206 * @param want the want of the ability to start. 207 * @param callerToken caller ability token. 208 * @param asCallerSourceToken source caller ability token. 209 * @param userId Designation User ID. 210 * @param requestCode the resultCode of the ability to start. 211 * @return Returns ERR_OK on success, others on failure. 212 */ 213 virtual int StartAbilityAsCaller( 214 const Want &want, 215 const sptr<IRemoteObject> &callerToken, 216 sptr<IRemoteObject> asCallerSourceToken, 217 int32_t userId = DEFAULT_INVAL_VALUE, 218 int requestCode = DEFAULT_INVAL_VALUE) 219 { 220 return 0; 221 } 222 223 /** 224 * Starts a new ability using the original caller information. 225 * 226 * @param want the want of the ability to start. 227 * @param startOptions Indicates the options used to start. 228 * @param callerToken caller ability token. 229 * @param asCallerSourceToken source caller ability token. 230 * @param userId Designation User ID. 231 * @param requestCode the resultCode of the ability to start. 232 * @return Returns ERR_OK on success, others on failure. 233 */ 234 virtual int StartAbilityAsCaller( 235 const Want &want, 236 const StartOptions &startOptions, 237 const sptr<IRemoteObject> &callerToken, 238 sptr<IRemoteObject> asCallerSourceToken, 239 int32_t userId = DEFAULT_INVAL_VALUE, 240 int requestCode = DEFAULT_INVAL_VALUE) 241 { 242 return 0; 243 } 244 245 /** 246 * Starts a new ability for result using the original caller information. 247 * 248 * @param want the want of the ability to start. 249 * @param callerToken current caller ability token. 250 * @param requestCode the resultCode of the ability to start. 251 * @param userId Designation User ID. 252 * @return Returns ERR_OK on success, others on failure. 253 */ 254 virtual int StartAbilityForResultAsCaller( 255 const Want &want, 256 const sptr<IRemoteObject> &callerToken, 257 int requestCode = DEFAULT_INVAL_VALUE, 258 int32_t userId = DEFAULT_INVAL_VALUE) 259 { 260 return 0; 261 } 262 263 /** 264 * Starts a new ability for result using the original caller information. 265 * 266 * @param want the want of the ability to start. 267 * @param startOptions Indicates the options used to start. 268 * @param callerToken current caller ability token. 269 * @param requestCode the resultCode of the ability to start. 270 * @param userId Designation User ID. 271 * @return Returns ERR_OK on success, others on failure. 272 */ 273 virtual int StartAbilityForResultAsCaller( 274 const Want &want, 275 const StartOptions &startOptions, 276 const sptr<IRemoteObject> &callerToken, 277 int requestCode = DEFAULT_INVAL_VALUE, 278 int32_t userId = DEFAULT_INVAL_VALUE) 279 { 280 return 0; 281 } 282 283 /** 284 * Start ui session ability with extension session info, send session info to ability manager service. 285 * 286 * @param want, the want of the ability to start. 287 * @param callerToken, caller ability token. 288 * @param sessionInfo the information of UIExtensionContentSession. 289 * @param userId, Designation User ID. 290 * @param requestCode, Ability request code. 291 * @return Returns ERR_OK on success, others on failure. 292 */ 293 virtual int StartAbilityByUIContentSession( 294 const Want &want, 295 const sptr<IRemoteObject> &callerToken, 296 const sptr<SessionInfo> &sessionInfo, 297 int32_t userId = DEFAULT_INVAL_VALUE, 298 int requestCode = DEFAULT_INVAL_VALUE) 299 { 300 return 0; 301 } 302 303 /** 304 * Start ui session ability with extension session info, send session info to ability manager service. 305 * 306 * @param want, the want of the ability to start. 307 * @param startOptions Indicates the options used to start. 308 * @param callerToken, caller ability token. 309 * @param sessionInfo the information of UIExtensionContentSession. 310 * @param userId, Designation User ID. 311 * @param requestCode the resultCode of the ability to start. 312 * @return Returns ERR_OK on success, others on failure. 313 */ 314 virtual int StartAbilityByUIContentSession( 315 const Want &want, 316 const StartOptions &startOptions, 317 const sptr<IRemoteObject> &callerToken, 318 const sptr<SessionInfo> &sessionInfo, 319 int32_t userId = DEFAULT_INVAL_VALUE, 320 int requestCode = DEFAULT_INVAL_VALUE) 321 { 322 return 0; 323 } 324 325 /** 326 * Start ui ability 327 * 328 * @param want the want of the ability to start. 329 * @param callerToken caller ability token. 330 * @param specifyTokenId The Caller ID. 331 * @return Returns ERR_OK on success, others on failure. 332 */ StartAbilityOnlyUIAbility(const Want & want,const sptr<IRemoteObject> & callerToken,uint32_t specifyTokenId)333 virtual int StartAbilityOnlyUIAbility( 334 const Want &want, 335 const sptr<IRemoteObject> &callerToken, 336 uint32_t specifyTokenId) 337 { 338 return 0; 339 } 340 341 /** 342 * Start extension ability with want, send want to ability manager service. 343 * 344 * @param want, the want of the ability to start. 345 * @param callerToken, caller ability token. 346 * @param userId, Designation User ID. 347 * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be started. 348 * @return Returns ERR_OK on success, others on failure. 349 */ 350 virtual int StartExtensionAbility( 351 const Want &want, 352 const sptr<IRemoteObject> &callerToken, 353 int32_t userId = DEFAULT_INVAL_VALUE, 354 AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED) 355 { 356 return 0; 357 } 358 359 /** 360 * Create UIExtension with want, send want to ability manager service. 361 * 362 * @param want, the want of the ability to start. 363 * @return Returns ERR_OK on success, others on failure. 364 */ RequestModalUIExtension(const Want & want)365 virtual int RequestModalUIExtension(const Want &want) 366 { 367 return 0; 368 } 369 370 /** 371 * Preload UIExtension with want, send want to ability manager service. 372 * 373 * @param want, the want of the ability to start. 374 * @param hostBundleName, the caller application bundle name. 375 * @param userId, the extension runs in. 376 * @return Returns ERR_OK on success, others on failure. 377 */ 378 virtual int PreloadUIExtensionAbility(const Want &want, std::string &hostBundleName, 379 int32_t userId = DEFAULT_INVAL_VALUE) 380 { 381 return 0; 382 } 383 ChangeAbilityVisibility(sptr<IRemoteObject> token,bool isShow)384 virtual int ChangeAbilityVisibility(sptr<IRemoteObject> token, bool isShow) 385 { 386 return 0; 387 } 388 ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo,bool isShow)389 virtual int ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo, bool isShow) 390 { 391 return 0; 392 } 393 394 /** 395 * Start ui extension ability with extension session info, send extension session info to ability manager service. 396 * 397 * @param extensionSessionInfo the extension session info of the ability to start. 398 * @param userId, Designation User ID. 399 * @return Returns ERR_OK on success, others on failure. 400 */ 401 virtual int StartUIExtensionAbility( 402 const sptr<SessionInfo> &extensionSessionInfo, 403 int32_t userId = DEFAULT_INVAL_VALUE) 404 { 405 return 0; 406 } 407 408 /** 409 * Start ui ability with want, send want to ability manager service. 410 * 411 * @param sessionInfo the session info of the ability to start. 412 * @param isColdStart the session info of the ability is or not cold start. 413 * @return Returns ERR_OK on success, others on failure. 414 */ 415 virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0) 416 { 417 return 0; 418 } 419 420 /** 421 * Stop extension ability with want, send want to ability manager service. 422 * 423 * @param want, the want of the ability to stop. 424 * @param callerToken, caller ability token. 425 * @param userId, Designation User ID. 426 * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be stopped. 427 * @return Returns ERR_OK on success, others on failure. 428 */ 429 virtual int StopExtensionAbility( 430 const Want& want, 431 const sptr<IRemoteObject>& callerToken, 432 int32_t userId = DEFAULT_INVAL_VALUE, 433 AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED) 434 { 435 return 0; 436 } 437 GetAppMemorySize()438 virtual int GetAppMemorySize() 439 { 440 return 0; 441 } 442 IsRamConstrainedDevice()443 virtual bool IsRamConstrainedDevice() 444 { 445 return false; 446 } 447 448 virtual AppExecFwk::ElementName GetTopAbility(bool isNeedLocalDeviceId = true) 449 { 450 return {}; 451 } 452 453 virtual AppExecFwk::ElementName GetElementNameByToken(sptr<IRemoteObject> token, 454 bool isNeedLocalDeviceId = true) 455 { 456 return {}; 457 } 458 459 /** 460 * TerminateAbility, terminate the special ability. 461 * 462 * @param token, the token of the ability to terminate. 463 * @param resultCode, the resultCode of the ability to terminate. 464 * @param resultWant, the Want of the ability to return. 465 * @return Returns ERR_OK on success, others on failure. 466 */ 467 virtual int TerminateAbility( 468 const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) = 0; 469 470 /** 471 * BackToCallerAbilityWithResult, return to the caller ability. 472 * 473 * @param token, the token of the ability to terminate. 474 * @param resultCode, the resultCode of the ability to terminate. 475 * @param resultWant, the Want of the ability to return. 476 * @param callerRequestCode, the requestCode of caller ability.· 477 * @return Returns ERR_OK on success, others on failure. 478 */ BackToCallerAbilityWithResult(const sptr<IRemoteObject> & token,int resultCode,const Want * resultWant,int64_t callerRequestCode)479 virtual int BackToCallerAbilityWithResult(const sptr<IRemoteObject> &token, int resultCode, 480 const Want *resultWant, int64_t callerRequestCode) 481 { 482 return 0; 483 }; 484 485 /** 486 * TerminateUIServiceExtensionAbility, terminate the UIServiceExtensionAbility. 487 * 488 * @param token, the token of the ability to terminate. 489 * @return Returns ERR_OK on success, others on failure. 490 */ TerminateUIServiceExtensionAbility(const sptr<IRemoteObject> & token)491 virtual int32_t TerminateUIServiceExtensionAbility(const sptr<IRemoteObject> &token) 492 { 493 return 0; 494 } 495 496 /** 497 * TerminateUIExtensionAbility, terminate the special ui extension ability. 498 * 499 * @param extensionSessionInfo the extension session info of the ability to terminate. 500 * @param resultCode, the resultCode of the ui extension ability to terminate. 501 * @param resultWant, the Want of the ui extension ability to return. 502 * @return Returns ERR_OK on success, others on failure. 503 */ 504 virtual int TerminateUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo, 505 int resultCode, const Want *resultWant = nullptr) 506 { 507 return 0; 508 } 509 510 /** 511 * CloseUIExtensionAbilityBySCB, terminate the specified ui extension ability by SCB. 512 * 513 * @param token the ability token. 514 * @return Returns ERR_OK on success, others on failure. 515 */ CloseUIExtensionAbilityBySCB(const sptr<IRemoteObject> token)516 virtual int CloseUIExtensionAbilityBySCB(const sptr<IRemoteObject> token) 517 { 518 return 0; 519 } 520 521 /** 522 * CloseUIAbilityBySCB, close the special ability by scb. 523 * 524 * @param sessionInfo the session info of the ability to terminate. 525 * @return Returns ERR_OK on success, others on failure. 526 */ CloseUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo)527 virtual int CloseUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo) 528 { 529 return 0; 530 } 531 532 /** 533 * SendResultToAbility, send the result to ability. 534 * 535 * @param requestCode, the requestCode of the ability to terminate. 536 * @param resultCode, the resultCode of the ability to terminate. 537 * @param resultWant, the Want of the ability to return. 538 * @return Returns ERR_OK on success, others on failure. 539 */ SendResultToAbility(int requestCode,int resultCode,Want & resultWant)540 virtual int SendResultToAbility(int requestCode, int resultCode, Want &resultWant) 541 { 542 return 0; 543 } 544 545 /** 546 * MoveAbilityToBackground. 547 * 548 * @param token, the token of the ability to move. 549 * @return Returns ERR_OK on success, others on failure. 550 */ MoveAbilityToBackground(const sptr<IRemoteObject> & token)551 virtual int MoveAbilityToBackground(const sptr<IRemoteObject> &token) 552 { 553 return 0; 554 }; 555 556 /** 557 * Move the UIAbility to background, called by app self. 558 * 559 * @param token the token of the ability to move. 560 * @return Returns ERR_OK on success, others on failure. 561 */ MoveUIAbilityToBackground(const sptr<IRemoteObject> token)562 virtual int32_t MoveUIAbilityToBackground(const sptr<IRemoteObject> token) 563 { 564 return 0; 565 }; 566 567 /** 568 * CloseAbility, close the special ability. 569 * 570 * @param token, the token of the ability to terminate. 571 * @param resultCode, the resultCode of the ability to terminate. 572 * @param resultWant, the Want of the ability to return. 573 * @return Returns ERR_OK on success, others on failure. 574 */ 575 virtual int CloseAbility(const sptr<IRemoteObject> &token, int resultCode = DEFAULT_INVAL_VALUE, 576 const Want *resultWant = nullptr) = 0; 577 578 /** 579 * MinimizeAbility, minimize the special ability. 580 * 581 * @param token, the token of the ability to minimize. 582 * @param fromUser mark the minimize operation source. 583 * @return Returns ERR_OK on success, others on failure. 584 */ 585 virtual int MinimizeAbility(const sptr<IRemoteObject> &token, bool fromUser = false) = 0; 586 587 /** 588 * MinimizeUIExtensionAbility, minimize the special ui extension ability. 589 * 590 * @param extensionSessionInfo the extension session info of the ability to minimize. 591 * @param fromUser mark the minimize operation source. 592 * @return Returns ERR_OK on success, others on failure. 593 */ 594 virtual int MinimizeUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo, 595 bool fromUser = false) 596 { 597 return 0; 598 }; 599 600 /** 601 * MinimizeUIAbilityBySCB, minimize the special ui ability by scb. 602 * 603 * @param sessionInfo the session info of the ability to minimize. 604 * @param fromUser, Whether form user. 605 * @return Returns ERR_OK on success, others on failure. 606 */ 607 virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false, 608 uint32_t sceneFlag = 0) 609 { 610 return 0; 611 }; 612 613 /** 614 * ConnectAbility, connect session with service ability. 615 * 616 * @param want, Special want for service type's ability. 617 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 618 * @param callerToken, caller ability token. 619 * @param userId, Designation User ID. 620 * @return Returns ERR_OK on success, others on failure. 621 */ 622 virtual int ConnectAbility( 623 const Want &want, 624 const sptr<IAbilityConnection> &connect, 625 const sptr<IRemoteObject> &callerToken, 626 int32_t userId = DEFAULT_INVAL_VALUE) = 0; 627 628 /** 629 * Connect ability common method. 630 * 631 * @param want, special want for service type's ability. 632 * @param connect, callback used to notify caller the result of connecting or disconnecting. 633 * @param callerToken, caller ability token. 634 * @param extensionType, type of the extension. 635 * @param userId, the service user ID. 636 * @return Returns ERR_OK on success, others on failure. 637 */ 638 virtual int ConnectAbilityCommon( 639 const Want &want, 640 const sptr<IAbilityConnection> &connect, 641 const sptr<IRemoteObject> &callerToken, 642 AppExecFwk::ExtensionAbilityType extensionType, 643 int32_t userId = DEFAULT_INVAL_VALUE, 644 bool isQueryExtensionOnly = false) 645 { 646 return 0; 647 } 648 649 /** 650 * Connect ui extension ability. 651 * 652 * @param want, special want for the ui extension ability. 653 * @param connect, callback used to notify caller the result of connecting or disconnecting. 654 * @param sessionInfo the extension session info of the ability to connect. 655 * @param userId, the extension runs in. 656 * @param connectInfo the connect info. 657 * @return Returns ERR_OK on success, others on failure. 658 */ 659 virtual int ConnectUIExtensionAbility(const Want &want, const sptr<IAbilityConnection> &connect, 660 const sptr<SessionInfo> &sessionInfo, int32_t userId = DEFAULT_INVAL_VALUE, 661 sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr) 662 { 663 return 0; 664 } 665 666 /** 667 * DisconnectAbility, disconnect session with service ability. 668 * 669 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 670 * @return Returns ERR_OK on success, others on failure. 671 */ 672 virtual int DisconnectAbility(sptr<IAbilityConnection> connect) = 0; 673 674 /** 675 * AcquireDataAbility, acquire a data ability by its authority, if it not existed, 676 * AMS loads it synchronously. 677 * 678 * @param authority, a string to identify a data ability, decoded from uri. 679 * @param tryBind, true: when a data ability is died, ams will kill this client, or do nothing. 680 * @param callerToken, specifies the caller ability token. 681 * @return returns the data ability ipc object, or nullptr for failed. 682 */ 683 virtual sptr<IAbilityScheduler> AcquireDataAbility( 684 const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken) = 0; 685 686 /** 687 * ReleaseDataAbility, release the data ability that referenced by 'dataAbilityToken'. 688 * 689 * @param dataAbilityScheduler, specifies the data ability that will be released. 690 * @param callerToken, specifies the caller ability token. 691 * @return returns ERR_OK if succeeded, or error codes for failed. 692 */ 693 virtual int ReleaseDataAbility( 694 sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) = 0; 695 696 /** 697 * AttachAbilityThread, ability call this interface after loaded. 698 * 699 * @param scheduler,.the interface handler of kit ability. 700 * @param token,.ability's token. 701 * @return Returns ERR_OK on success, others on failure. 702 */ 703 virtual int AttachAbilityThread(const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) = 0; 704 705 /** 706 * AbilityTransitionDone, ability call this interface after life cycle was changed. 707 * 708 * @param token,.ability's token. 709 * @param state,.the state of ability life cycle. 710 * @return Returns ERR_OK on success, others on failure. 711 */ 712 virtual int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) = 0; 713 714 /** 715 * AbilityWindowConfigTransitionDone, ability call this interface after life cycle was changed. 716 * 717 * @param token,.ability's token. 718 * @return Returns ERR_OK on success, others on failure. 719 */ AbilityWindowConfigTransitionDone(const sptr<IRemoteObject> & token,const WindowConfig & windowConfig)720 virtual int AbilityWindowConfigTransitionDone( 721 const sptr<IRemoteObject> &token, const WindowConfig &windowConfig) 722 { 723 return 0; 724 } 725 726 /** 727 * ScheduleConnectAbilityDone, service ability call this interface while session was connected. 728 * 729 * @param token,.service ability's token. 730 * @param remoteObject,.the session proxy of service ability. 731 * @return Returns ERR_OK on success, others on failure. 732 */ 733 virtual int ScheduleConnectAbilityDone( 734 const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) = 0; 735 736 /** 737 * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected. 738 * 739 * @param token,.service ability's token. 740 * @return Returns ERR_OK on success, others on failure. 741 */ 742 virtual int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) = 0; 743 744 /** 745 * ScheduleCommandAbilityDone, service ability call this interface while session was commanded. 746 * 747 * @param token,.service ability's token. 748 * @return Returns ERR_OK on success, others on failure. 749 */ 750 virtual int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) = 0; 751 752 virtual int ScheduleCommandAbilityWindowDone( 753 const sptr<IRemoteObject> &token, 754 const sptr<AAFwk::SessionInfo> &sessionInfo, 755 AAFwk::WindowCommand winCmd, 756 AAFwk::AbilityCommand abilityCmd) = 0; 757 758 /** 759 * dump ability stack info, about userID, mission stack info, 760 * mission record info and ability info. 761 * 762 * @param state Ability stack info. 763 * @return Returns ERR_OK on success, others on failure. 764 */ 765 virtual void DumpState(const std::string &args, std::vector<std::string> &state) = 0; 766 virtual void DumpSysState( 767 const std::string& args, std::vector<std::string>& state, bool isClient, bool isUserID, int UserID) = 0; 768 769 /** 770 * Destroys this Service ability by Want. 771 * 772 * @param want, Special want for service type's ability. 773 * @param token ability's token. 774 * @return Returns true if this Service ability will be destroyed; returns false otherwise. 775 */ 776 virtual int StopServiceAbility(const Want &want, int32_t userId = DEFAULT_INVAL_VALUE, 777 const sptr<IRemoteObject> &token = nullptr) = 0; 778 779 /** 780 * Kill the process immediately. 781 * 782 * @param bundleName. 783 * @return Returns ERR_OK on success, others on failure. 784 */ 785 virtual int KillProcess(const std::string &bundleName, const bool clearPageStack = true) = 0; 786 787 #ifdef ABILITY_COMMAND_FOR_TEST 788 /** 789 * force timeout ability. 790 * 791 * @param abilityName. 792 * @param state. 793 * @return Returns ERR_OK on success, others on failure. 794 */ 795 virtual int ForceTimeoutForTest(const std::string &abilityName, const std::string &state) = 0; 796 #endif 797 798 /** 799 * Uninstall app 800 * 801 * @param bundleName bundle name of uninstalling app. 802 * @param uid uid of bundle. 803 * @return Returns ERR_OK on success, others on failure. 804 */ UninstallApp(const std::string & bundleName,int32_t uid)805 virtual int UninstallApp(const std::string &bundleName, int32_t uid) 806 { 807 return 0; 808 } 809 810 /** 811 * Uninstall app 812 * 813 * @param bundleName bundle name of uninstalling app. 814 * @param uid uid of bundle. 815 * @param appIndex the app index of app clone. 816 * @return Returns ERR_OK on success, others on failure. 817 */ UninstallApp(const std::string & bundleName,int32_t uid,int32_t appIndex)818 virtual int32_t UninstallApp(const std::string &bundleName, int32_t uid, int32_t appIndex) 819 { 820 return 0; 821 } 822 823 /** 824 * Upgrade app, record exit reason and kill application 825 * 826 * @param bundleName bundle name of upgrading app. 827 * @param uid uid of bundle. 828 * @param exitMsg the exit reason message. 829 * @param appIndex the app index of app clone. 830 * @return Returns ERR_OK on success, others on failure. 831 */ 832 virtual int32_t UpgradeApp(const std::string &bundleName, const int32_t uid, const std::string &exitMsg, 833 int32_t appIndex = 0) 834 { 835 return 0; 836 } 837 838 virtual sptr<IWantSender> GetWantSender( 839 const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid = -1) = 0; 840 841 virtual int SendWantSender(sptr<IWantSender> target, const SenderInfo &senderInfo) = 0; 842 843 virtual void CancelWantSender(const sptr<IWantSender> &sender) = 0; 844 845 virtual int GetPendingWantUid(const sptr<IWantSender> &target) = 0; 846 847 virtual int GetPendingWantUserId(const sptr<IWantSender> &target) = 0; 848 849 virtual std::string GetPendingWantBundleName(const sptr<IWantSender> &target) = 0; 850 851 virtual int GetPendingWantCode(const sptr<IWantSender> &target) = 0; 852 853 virtual int GetPendingWantType(const sptr<IWantSender> &target) = 0; 854 855 virtual void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) = 0; 856 857 virtual void UnregisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) = 0; 858 859 virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) = 0; 860 861 virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) = 0; 862 863 virtual int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId, int32_t missionId, 864 const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) = 0; 865 ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo,const sptr<IRemoteObject> & callback)866 virtual int ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo, const sptr<IRemoteObject> &callback) 867 { 868 return 0; 869 } 870 871 virtual int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) = 0; 872 873 virtual int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) = 0; 874 875 virtual void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) = 0; 876 877 virtual int NotifyContinuationResult(int32_t missionId, int32_t result) = 0; 878 879 virtual int LockMissionForCleanup(int32_t missionId) = 0; 880 881 virtual int UnlockMissionForCleanup(int32_t missionId) = 0; 882 SetLockedState(int32_t sessionId,bool lockedState)883 virtual void SetLockedState(int32_t sessionId, bool lockedState) 884 { 885 return; 886 } 887 888 virtual int RegisterMissionListener(const sptr<IMissionListener> &listener) = 0; 889 890 virtual int UnRegisterMissionListener(const sptr<IMissionListener> &listener) = 0; 891 892 virtual int GetMissionInfos( 893 const std::string &deviceId, int32_t numMax, std::vector<MissionInfo> &missionInfos) = 0; 894 895 virtual int GetMissionInfo(const std::string &deviceId, int32_t missionId, MissionInfo &missionInfo) = 0; 896 897 virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, 898 MissionSnapshot& snapshot, bool isLowResolution) = 0; 899 900 virtual int CleanMission(int32_t missionId) = 0; 901 902 virtual int CleanAllMissions() = 0; 903 904 virtual int MoveMissionToFront(int32_t missionId) = 0; 905 906 virtual int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) = 0; 907 MoveMissionsToForeground(const std::vector<int32_t> & missionIds,int32_t topMissionId)908 virtual int MoveMissionsToForeground(const std::vector<int32_t>& missionIds, int32_t topMissionId) 909 { 910 return 0; 911 } 912 MoveMissionsToBackground(const std::vector<int32_t> & missionIds,std::vector<int32_t> & result)913 virtual int MoveMissionsToBackground(const std::vector<int32_t>& missionIds, std::vector<int32_t>& result) 914 { 915 return 0; 916 } 917 RegisterSessionHandler(const sptr<IRemoteObject> & object)918 virtual int RegisterSessionHandler(const sptr<IRemoteObject> &object) 919 { 920 return 0; 921 } 922 923 /** 924 * Start Ability, connect session with common ability. 925 * 926 * @param want, Special want for service type's ability. 927 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 928 * @param accountId Indicates the account to start. 929 * @return Returns ERR_OK on success, others on failure. 930 */ 931 virtual int StartAbilityByCall(const Want &want, const sptr<IAbilityConnection> &connect, 932 const sptr<IRemoteObject> &callerToken, int32_t accountId = DEFAULT_INVAL_VALUE) = 0; 933 934 /** 935 * CallRequestDone, after invoke callRequest, ability will call this interface to return callee. 936 * 937 * @param token, ability's token. 938 * @param callStub, ability's callee. 939 */ CallRequestDone(const sptr<IRemoteObject> & token,const sptr<IRemoteObject> & callStub)940 virtual void CallRequestDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &callStub) {}; 941 942 /** 943 * Release the call between Ability, disconnect session with common ability. 944 * 945 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 946 * @return Returns ERR_OK on success, others on failure. 947 */ 948 virtual int ReleaseCall(const sptr<IAbilityConnection> &connect, const AppExecFwk::ElementName &element) = 0; 949 950 virtual int StartUser(int userId, sptr<IUserCallback> callback) = 0; 951 952 virtual int StopUser(int userId, const sptr<IUserCallback> &callback) = 0; 953 LogoutUser(int32_t userId)954 virtual int LogoutUser(int32_t userId) 955 { 956 return 0; 957 } 958 SetMissionContinueState(const sptr<IRemoteObject> & token,const AAFwk::ContinueState & state)959 virtual int SetMissionContinueState(const sptr<IRemoteObject> &token, const AAFwk::ContinueState &state) 960 { 961 return 0; 962 }; 963 964 #ifdef SUPPORT_GRAPHICS 965 virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) = 0; 966 967 virtual int SetMissionIcon(const sptr<IRemoteObject> &token, 968 const std::shared_ptr<OHOS::Media::PixelMap> &icon) = 0; 969 970 /** 971 * Called to update mission snapshot. 972 * @param token The target ability. 973 * @param pixelMap The snapshot. 974 */ UpdateMissionSnapShot(const sptr<IRemoteObject> & token,const std::shared_ptr<OHOS::Media::PixelMap> & pixelMap)975 virtual void UpdateMissionSnapShot(const sptr<IRemoteObject> &token, 976 const std::shared_ptr<OHOS::Media::PixelMap> &pixelMap) {}; 977 978 /** 979 * Register the WindowManagerService handler 980 * 981 * @param handler Indidate handler of WindowManagerService. 982 * @return ErrCode Returns ERR_OK on success, others on failure. 983 */ RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> & handler,bool animationEnabled)984 virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler, 985 bool animationEnabled) 986 { 987 return 0; 988 } 989 990 /** 991 * WindowManager notification AbilityManager after the first frame is drawn. 992 * 993 * @param abilityToken Indidate token of ability. 994 */ 995 virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) = 0; 996 997 /** 998 * WindowManager notification AbilityManager after the first frame is drawn. 999 * 1000 * @param sessionId Indidate session id. 1001 */ CompleteFirstFrameDrawing(int32_t sessionId)1002 virtual void CompleteFirstFrameDrawing(int32_t sessionId) 1003 {} 1004 1005 /** 1006 * PrepareTerminateAbility, prepare terminate the special ability. 1007 * 1008 * @param token, the token of the ability to terminate. 1009 * @param callback callback. 1010 * @return Returns ERR_OK on success, others on failure. 1011 */ PrepareTerminateAbility(const sptr<IRemoteObject> & token,sptr<IPrepareTerminateCallback> & callback)1012 virtual int PrepareTerminateAbility(const sptr<IRemoteObject> &token, sptr<IPrepareTerminateCallback> &callback) 1013 { 1014 return 0; 1015 } 1016 GetDialogSessionInfo(const std::string & dialogSessionId,sptr<DialogSessionInfo> & dialogSessionInfo)1017 virtual int GetDialogSessionInfo(const std::string &dialogSessionId, sptr<DialogSessionInfo> &dialogSessionInfo) 1018 { 1019 return 0; 1020 } 1021 SendDialogResult(const Want & want,const std::string & dialogSessionId,bool isAllow)1022 virtual int SendDialogResult(const Want &want, const std::string &dialogSessionId, bool isAllow) 1023 { 1024 return 0; 1025 } 1026 1027 /** 1028 * Register ability first frame state observer. 1029 * @param observer Is ability first frame state observer. 1030 * @param bundleName Is bundleName of the app to observe. 1031 * @return Returns ERR_OK on success, others on failure. 1032 */ RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> & observer,const std::string & targetBundleName)1033 virtual int32_t RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer, 1034 const std::string &targetBundleName) 1035 { 1036 return 0; 1037 } 1038 1039 /** 1040 * Unregister ability first frame state observer. 1041 * @param observer Is ability first frame state observer. 1042 * @return Returns ERR_OK on success, others on failure. 1043 */ UnregisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> & observer)1044 virtual int32_t UnregisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer) 1045 { 1046 return 0; 1047 } 1048 1049 #endif 1050 1051 virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) = 0; 1052 1053 virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) = 0; 1054 1055 virtual int GetProcessRunningInfos(std::vector<AppExecFwk::RunningProcessInfo> &info) = 0; 1056 1057 /** 1058 * Start synchronizing remote device mission 1059 * @param devId, deviceId. 1060 * @param fixConflict, resolve synchronizing conflicts flag. 1061 * @param tag, call tag. 1062 * @return Returns ERR_OK on success, others on failure. 1063 */ 1064 virtual int StartSyncRemoteMissions(const std::string &devId, bool fixConflict, int64_t tag) = 0; 1065 1066 /** 1067 * Stop synchronizing remote device mission 1068 * @param devId, deviceId. 1069 * @return Returns ERR_OK on success, others on failure. 1070 */ 1071 virtual int StopSyncRemoteMissions(const std::string &devId) = 0; 1072 1073 virtual int RegisterMissionListener(const std::string &deviceId, const sptr<IRemoteMissionListener> &listener) = 0; 1074 RegisterOnListener(const std::string & type,const sptr<IRemoteOnListener> & listener)1075 virtual int RegisterOnListener(const std::string &type, const sptr<IRemoteOnListener> &listener) 1076 { 1077 return 0; 1078 } 1079 RegisterOffListener(const std::string & type,const sptr<IRemoteOnListener> & listener)1080 virtual int RegisterOffListener(const std::string &type, const sptr<IRemoteOnListener> &listener) 1081 { 1082 return 0; 1083 } 1084 1085 virtual int UnRegisterMissionListener(const std::string &deviceId, 1086 const sptr<IRemoteMissionListener> &listener) = 0; 1087 1088 /** 1089 * Set ability controller. 1090 * 1091 * @param abilityController, The ability controller. 1092 * @return Returns ERR_OK on success, others on failure. 1093 */ 1094 virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController, 1095 bool imAStabilityTest) = 0; 1096 1097 /** 1098 * Is user a stability test. 1099 * 1100 * @return Returns true if user is a stability test. 1101 */ 1102 virtual bool IsRunningInStabilityTest() = 0; 1103 1104 /** 1105 * @brief Register the snapshot handler 1106 * @param handler snapshot handler 1107 * @return int Returns ERR_OK on success, others on failure. 1108 */ 1109 virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) = 0; 1110 1111 virtual int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) = 0; 1112 1113 virtual int FinishUserTest(const std::string &msg, const int64_t &resultCode, const std::string &bundleName) = 0; 1114 1115 /** 1116 * GetTopAbility, get the token of top ability. 1117 * 1118 * @param token, the token of top ability. 1119 * @return Returns ERR_OK on success, others on failure. 1120 */ 1121 virtual int GetTopAbility(sptr<IRemoteObject> &token) = 0; 1122 CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId,bool & isFocused)1123 virtual int CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId, bool& isFocused) 1124 { 1125 return 0; 1126 } 1127 1128 /** 1129 * The delegator calls this interface to move the ability to the foreground. 1130 * 1131 * @param token, ability's token. 1132 * @return Returns ERR_OK on success, others on failure. 1133 */ 1134 virtual int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) = 0; 1135 1136 /** 1137 * The delegator calls this interface to move the ability to the background. 1138 * 1139 * @param token, ability's token. 1140 * @return Returns ERR_OK on success, others on failure. 1141 */ 1142 virtual int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) = 0; 1143 1144 /** 1145 * Calls this interface to move the ability to the foreground. 1146 * 1147 * @param token, ability's token. 1148 * @param flag, use for lock or unlock flag and so on. 1149 * @return Returns ERR_OK on success, others on failure. 1150 */ 1151 virtual int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) = 0; 1152 1153 /** 1154 * Calls this interface to move the ability to the background. 1155 * 1156 * @param token, ability's token. 1157 * @param flag, use for lock or unlock flag and so on. 1158 * @return Returns ERR_OK on success, others on failure. 1159 */ 1160 virtual int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) = 0; 1161 1162 /** 1163 * Get mission id by ability token. 1164 * 1165 * @param token The token of ability. 1166 * @return Returns -1 if do not find mission, otherwise return mission id. 1167 */ 1168 virtual int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) = 0; 1169 1170 /** 1171 * Get ability token by connect. 1172 * 1173 * @param token The token of ability. 1174 * @param callStub The callee object. 1175 */ 1176 virtual void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) = 0; 1177 1178 /** 1179 * Called when client complete dump. 1180 * 1181 * @param infos The dump info. 1182 * @return Returns ERR_OK on success, others on failure. 1183 */ DumpAbilityInfoDone(std::vector<std::string> & infos,const sptr<IRemoteObject> & callerToken)1184 virtual int DumpAbilityInfoDone(std::vector<std::string> &infos, const sptr<IRemoteObject> &callerToken) 1185 { 1186 return 0; 1187 } 1188 1189 /** 1190 * Call free install from remote. 1191 * 1192 * @param want, the want of the ability to start. 1193 * @param callback, Callback from remote. 1194 * @param userId, Designation User ID. 1195 * @param requestCode Ability request code. 1196 * @return Returns ERR_OK on success, others on failure. 1197 */ 1198 virtual int FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback, 1199 int32_t userId, int requestCode = DEFAULT_INVAL_VALUE) 1200 { 1201 return 0; 1202 } 1203 1204 /** 1205 * Add free install observer. 1206 * 1207 * @param callerToken, The caller ability token. 1208 * @param observer, The observer of the ability to free install start. 1209 * @return Returns ERR_OK on success, others on failure. 1210 */ AddFreeInstallObserver(const sptr<IRemoteObject> & callerToken,const sptr<AbilityRuntime::IFreeInstallObserver> & observer)1211 virtual int AddFreeInstallObserver(const sptr<IRemoteObject> &callerToken, 1212 const sptr<AbilityRuntime::IFreeInstallObserver> &observer) 1213 { 1214 return 0; 1215 } 1216 EnableRecoverAbility(const sptr<IRemoteObject> & token)1217 virtual void EnableRecoverAbility(const sptr<IRemoteObject>& token) {}; SubmitSaveRecoveryInfo(const sptr<IRemoteObject> & token)1218 virtual void SubmitSaveRecoveryInfo(const sptr<IRemoteObject>& token) {}; 1219 virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason, 1220 const Want *want = nullptr) {}; ScheduleClearRecoveryPageStack()1221 virtual void ScheduleClearRecoveryPageStack() {}; 1222 1223 /** 1224 * Called to verify that the MissionId is valid. 1225 * @param missionIds Query mission list. 1226 * @param results Output parameters, return results up to 20 query results. 1227 * @return Returns ERR_OK on success, others on failure. 1228 */ 1229 virtual int32_t IsValidMissionIds( 1230 const std::vector<int32_t> &missionIds, std::vector<MissionValidResult> &results) = 0; 1231 1232 /** 1233 * Query whether the application of the specified PID and UID has been granted a certain permission 1234 * @param permission 1235 * @param pid Process id 1236 * @param uid 1237 * @return Returns ERR_OK if the current process has the permission, others on failure. 1238 */ VerifyPermission(const std::string & permission,int pid,int uid)1239 virtual int VerifyPermission(const std::string &permission, int pid, int uid) 1240 { 1241 return 0; 1242 } 1243 1244 /** 1245 * Request dialog service with want, send want to ability manager service. 1246 * 1247 * @param want, the want of the dialog service to start. 1248 * @param callerToken, caller ability token. 1249 * @return Returns ERR_OK on success, others on failure. 1250 */ RequestDialogService(const Want & want,const sptr<IRemoteObject> & callerToken)1251 virtual int32_t RequestDialogService(const Want &want, const sptr<IRemoteObject> &callerToken) 1252 { 1253 return 0; 1254 } 1255 1256 /** 1257 * Report drawn completed. 1258 * 1259 * @return Returns ERR_OK on success, others on failure. 1260 */ 1261 virtual int32_t ReportDrawnCompleted(const sptr<IRemoteObject> &callerToken) = 0; 1262 1263 /** 1264 * Acquire the shared data. 1265 * @param missionId The missionId of Target ability. 1266 * @param shareData The IAcquireShareData object. 1267 * @return Returns ERR_OK on success, others on failure. 1268 */ AcquireShareData(const int32_t & missionId,const sptr<IAcquireShareDataCallback> & shareData)1269 virtual int32_t AcquireShareData(const int32_t &missionId, const sptr<IAcquireShareDataCallback> &shareData) 1270 { 1271 return 0; 1272 } 1273 1274 /** 1275 * Notify sharing data finished. 1276 * @param token The token of ability. 1277 * @param resultCode The result of sharing data. 1278 * @param uniqueId The uniqueId from request object. 1279 * @param wantParam The params of acquiring sharing data from target ability. 1280 * @return Returns ERR_OK on success, others on failure. 1281 */ ShareDataDone(const sptr<IRemoteObject> & token,const int32_t & resultCode,const int32_t & uniqueId,WantParams & wantParam)1282 virtual int32_t ShareDataDone(const sptr<IRemoteObject>& token, 1283 const int32_t &resultCode, const int32_t &uniqueId, WantParams &wantParam) 1284 { 1285 return 0; 1286 } 1287 1288 /** 1289 * Force app exit and record exit reason. 1290 * @param pid Process id . 1291 * @param exitReason The reason of app exit. 1292 * @return Returns ERR_OK on success, others on failure. 1293 */ ForceExitApp(const int32_t pid,const ExitReason & exitReason)1294 virtual int32_t ForceExitApp(const int32_t pid, const ExitReason &exitReason) 1295 { 1296 return 0; 1297 } 1298 1299 /** 1300 * Record app exit reason. 1301 * @param exitReason The reason of app exit. 1302 * @return Returns ERR_OK on success, others on failure. 1303 */ RecordAppExitReason(const ExitReason & exitReason)1304 virtual int32_t RecordAppExitReason(const ExitReason &exitReason) 1305 { 1306 return 0; 1307 } 1308 1309 /** 1310 * Record the process exit reason before the process being killed. 1311 * @param pid The process id. 1312 * @param exitReason The reason of process exit. 1313 * @return Returns ERR_OK on success, others on failure. 1314 */ RecordProcessExitReason(const int32_t pid,const ExitReason & exitReason)1315 virtual int32_t RecordProcessExitReason(const int32_t pid, const ExitReason &exitReason) 1316 { 1317 return 0; 1318 } 1319 1320 /** 1321 * Set rootSceneSession by SCB. 1322 * 1323 * @param rootSceneSession Indicates root scene session of SCB. 1324 */ SetRootSceneSession(const sptr<IRemoteObject> & rootSceneSession)1325 virtual void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession) {} 1326 1327 /** 1328 * Call UIAbility by SCB. 1329 * 1330 * @param sessionInfo the session info of the ability to be called. 1331 * @param isColdStart the session of the ability is or not cold start. 1332 */ CallUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo,bool & isColdStart)1333 virtual void CallUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isColdStart) {} 1334 1335 /** 1336 * Start specified ability by SCB. 1337 * 1338 * @param want Want information. 1339 */ StartSpecifiedAbilityBySCB(const Want & want)1340 virtual void StartSpecifiedAbilityBySCB(const Want &want) {}; 1341 1342 /** 1343 * Notify sandbox app the result of saving file. 1344 * @param want Result of saving file, which contains the file's uri if success. 1345 * @param resultCode Indicates the action's result. 1346 * @param requestCode Pass the requestCode to match request. 1347 * @return Returns ERR_OK on success, others on failure. 1348 */ NotifySaveAsResult(const Want & want,int resultCode,int requestCode)1349 virtual int32_t NotifySaveAsResult(const Want &want, int resultCode, int requestCode) 1350 { 1351 return 0; 1352 } 1353 1354 /** 1355 * Set sessionManagerService 1356 * @param sessionManagerService the point of sessionManagerService. 1357 * 1358 * @return Returns ERR_OK on success, others on failure. 1359 */ SetSessionManagerService(const sptr<IRemoteObject> & sessionManagerService)1360 virtual int32_t SetSessionManagerService(const sptr<IRemoteObject> &sessionManagerService) 1361 { 1362 return 0; 1363 } 1364 1365 /** 1366 * @brief Register collaborator. 1367 * @param type collaborator type. 1368 * @param impl collaborator. 1369 * @return 0 or else. 1370 */ RegisterIAbilityManagerCollaborator(int32_t type,const sptr<IAbilityManagerCollaborator> & impl)1371 virtual int32_t RegisterIAbilityManagerCollaborator(int32_t type, const sptr<IAbilityManagerCollaborator> &impl) 1372 { 1373 return 0; 1374 } 1375 1376 /** 1377 * @brief Unregister collaborator. 1378 * @param type collaborator type. 1379 * @return 0 or else. 1380 */ UnregisterIAbilityManagerCollaborator(int32_t type)1381 virtual int32_t UnregisterIAbilityManagerCollaborator(int32_t type) 1382 { 1383 return 0; 1384 } 1385 RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate)1386 virtual int32_t RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate) 1387 { 1388 return 0; 1389 } 1390 KillProcessWithPrepareTerminate(const std::vector<int32_t> & pids)1391 virtual int32_t KillProcessWithPrepareTerminate(const std::vector<int32_t>& pids) 1392 { 1393 return 0; 1394 } 1395 1396 /** 1397 * @brief Register auto start up callback for system api. 1398 * @param callback The point of JsAbilityAutoStartupCallBack. 1399 * @return Returns ERR_OK on success, others on failure. 1400 */ RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> & callback)1401 virtual int32_t RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback) 1402 { 1403 return 0; 1404 } 1405 1406 /** 1407 * @brief Unregister auto start up callback for system api. 1408 * @param callback The point of JsAbilityAutoStartupCallBack. 1409 * @return Returns ERR_OK on success, others on failure. 1410 */ UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> & callback)1411 virtual int32_t UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback) 1412 { 1413 return 0; 1414 } 1415 1416 /** 1417 * @brief Set every application auto start up state. 1418 * @param info The auto startup info,include bundle name, module name, ability name. 1419 * @return Returns ERR_OK on success, others on failure. 1420 */ SetApplicationAutoStartup(const AutoStartupInfo & info)1421 virtual int32_t SetApplicationAutoStartup(const AutoStartupInfo &info) 1422 { 1423 return 0; 1424 } 1425 1426 /** 1427 * @brief Cancel every application auto start up . 1428 * @param info The auto startup info,include bundle name, module name, ability name. 1429 * @return Returns ERR_OK on success, others on failure. 1430 */ CancelApplicationAutoStartup(const AutoStartupInfo & info)1431 virtual int32_t CancelApplicationAutoStartup(const AutoStartupInfo &info) 1432 { 1433 return 0; 1434 } 1435 1436 /** 1437 * @brief Query auto startup state all application. 1438 * @param infoList Output parameters, return auto startup info list. 1439 * @return Returns ERR_OK on success, others on failure. 1440 */ QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> & infoList)1441 virtual int32_t QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> &infoList) 1442 { 1443 return 0; 1444 } 1445 1446 /** 1447 * PrepareTerminateAbilityBySCB, prepare to terminate ability by scb. 1448 * 1449 * @param sessionInfo the session info of the ability to start. 1450 * @param isPrepareTerminate the result of ability onPrepareToTerminate 1451 * @return Returns ERR_OK on success, others on failure. 1452 */ PrepareTerminateAbilityBySCB(const sptr<SessionInfo> & sessionInfo,bool & isPrepareTerminate)1453 virtual int PrepareTerminateAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isPrepareTerminate) 1454 { 1455 return 0; 1456 } 1457 1458 /** 1459 * @brief Register app debug listener. 1460 * @param listener App debug listener. 1461 * @return Returns ERR_OK on success, others on failure. 1462 */ 1463 virtual int32_t RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) = 0; 1464 1465 /** 1466 * @brief Unregister app debug listener. 1467 * @param listener App debug listener. 1468 * @return Returns ERR_OK on success, others on failure. 1469 */ 1470 virtual int32_t UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) = 0; 1471 1472 /** 1473 * @brief Attach app debug. 1474 * @param bundleName The application bundle name. 1475 * @return Returns ERR_OK on success, others on failure. 1476 */ 1477 virtual int32_t AttachAppDebug(const std::string &bundleName) = 0; 1478 1479 /** 1480 * @brief Detach app debug. 1481 * @param bundleName The application bundle name. 1482 * @return Returns ERR_OK on success, others on failure. 1483 */ 1484 virtual int32_t DetachAppDebug(const std::string &bundleName) = 0; 1485 1486 /** 1487 * @brief Execute intent. 1488 * @param key The key of intent executing client. 1489 * @param callerToken Caller ability token. 1490 * @param param The Intent execute param. 1491 * @return Returns ERR_OK on success, others on failure. 1492 */ 1493 virtual int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken, 1494 const InsightIntentExecuteParam ¶m) = 0; 1495 1496 /** 1497 * @brief Check if ability controller can start. 1498 * @param want The want of ability to start. 1499 * @return Return true to allow ability to start, or false to reject. 1500 */ IsAbilityControllerStart(const Want & want)1501 virtual bool IsAbilityControllerStart(const Want &want) 1502 { 1503 return true; 1504 } 1505 1506 /** 1507 * @brief Called when insight intent execute finished. 1508 * 1509 * @param token ability's token. 1510 * @param intentId insight intent id. 1511 * @param result insight intent execute result. 1512 * @return Returns ERR_OK on success, others on failure. 1513 */ 1514 virtual int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId, 1515 const InsightIntentExecuteResult &result) = 0; 1516 1517 /** 1518 * @brief Set application auto start up state by EDM. 1519 * @param info The auto startup info, include bundle name, module name, ability name. 1520 * @param flag Indicate whether to allow the application to change the auto start up state. 1521 * @return Returns ERR_OK on success, others on failure. 1522 */ 1523 virtual int32_t SetApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) = 0; 1524 1525 /** 1526 * @brief Cancel application auto start up state by EDM. 1527 * @param info The auto startup info, include bundle name, module name, ability name. 1528 * @param flag Indicate whether to allow the application to change the auto start up state. 1529 * @return Returns ERR_OK on success, others on failure. 1530 */ 1531 virtual int32_t CancelApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) = 0; 1532 1533 /** 1534 * @brief Get foreground ui abilities. 1535 * @param list Foreground ui abilities. 1536 * @return Returns ERR_OK on success, others on failure. 1537 */ 1538 virtual int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) = 0; 1539 1540 /** 1541 * @brief Open file by uri. 1542 * @param uri The file uri. 1543 * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION. 1544 * @return int The file descriptor. 1545 */ OpenFile(const Uri & uri,uint32_t flag)1546 virtual int32_t OpenFile(const Uri& uri, uint32_t flag) 1547 { 1548 return 0; 1549 } 1550 1551 /** 1552 * @brief Update session info. 1553 * @param sessionInfos The vector of session info. 1554 */ UpdateSessionInfoBySCB(std::list<SessionInfo> & sessionInfos,int32_t userId,std::vector<int32_t> & sessionIds)1555 virtual int32_t UpdateSessionInfoBySCB(std::list<SessionInfo> &sessionInfos, int32_t userId, 1556 std::vector<int32_t> &sessionIds) 1557 { 1558 return 0; 1559 } 1560 1561 /** 1562 * @brief Restart app self. 1563 * @param want The ability type must be UIAbility. 1564 * @param isAppRecovery True indicates that the app is restarted because of recovery. 1565 * @return Returns ERR_OK on success, others on failure. 1566 */ 1567 virtual int32_t RestartApp(const AAFwk::Want &want, bool isAppRecovery = false) 1568 { 1569 return 0; 1570 } 1571 1572 /** 1573 * @brief Get host info of root caller. 1574 * 1575 * @param token The ability token. 1576 * @param hostInfo The host info of root caller. 1577 * @param userId The user id. 1578 * @return int32_t Returns 0 on success, others on failure. 1579 */ 1580 virtual int32_t GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token, UIExtensionHostInfo &hostInfo, 1581 int32_t userId = DEFAULT_INVAL_VALUE) 1582 { 1583 return 0; 1584 } 1585 1586 /** 1587 * @brief Get ui extension session info 1588 * 1589 * @param token The ability token. 1590 * @param uiExtensionSessionInfo The ui extension session info. 1591 * @param userId The user id. 1592 * @return int32_t Returns ERR_OK on success, others on failure. 1593 */ 1594 virtual int32_t GetUIExtensionSessionInfo(const sptr<IRemoteObject> token, 1595 UIExtensionSessionInfo &uiExtensionSessionInfo, int32_t userId = DEFAULT_INVAL_VALUE) 1596 { 1597 return 0; 1598 } 1599 1600 /** 1601 * Open link of ability and atomic service. 1602 * 1603 * @param want Ability want. 1604 * @param callerToken Caller ability token. 1605 * @param userId User ID. 1606 * @param requestCode Ability request code. 1607 * @return Returns ERR_OK on success, others on failure. 1608 */ 1609 virtual int32_t OpenLink(const Want& want, sptr<IRemoteObject> callerToken, 1610 int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE) 1611 { 1612 return 0; 1613 } 1614 1615 /** 1616 * @brief Pop-up launch of full-screen atomic service. 1617 * @param want The want with parameters. 1618 * @param callerToken caller ability token. 1619 * @param requestCode Ability request code. 1620 * @param userId The User ID. 1621 * @return Returns ERR_OK on success, others on failure. 1622 */ 1623 virtual int32_t OpenAtomicService(Want& want, const StartOptions &options, sptr<IRemoteObject> callerToken, 1624 int32_t requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE) 1625 { 1626 return 0; 1627 } 1628 1629 /* 1630 * Set the enable status for starting and stopping resident processes. 1631 * The caller application can only set the resident status of the configured process. 1632 * @param bundleName The bundle name of the resident process. 1633 * @param enable Set resident process enable status. 1634 * @return Returns ERR_OK on success, others on failure. 1635 */ SetResidentProcessEnabled(const std::string & bundleName,bool enable)1636 virtual int32_t SetResidentProcessEnabled(const std::string &bundleName, bool enable) 1637 { 1638 return 0; 1639 } 1640 1641 /** 1642 * @brief Querying whether to allow embedded startup of atomic service. 1643 * 1644 * @param token The caller UIAbility token. 1645 * @param appId The ID of the application to which this bundle belongs. 1646 * @return Returns true to allow ability to start, or false to reject. 1647 */ IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken,const std::string & appId)1648 virtual bool IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId) 1649 { 1650 return true; 1651 } 1652 1653 /** 1654 * @brief Request to display assert fault dialog. 1655 * @param callback Listen for user operation callbacks. 1656 * @param wantParams Assert dialog box display information. 1657 * @return Returns ERR_OK on success, others on failure. 1658 */ RequestAssertFaultDialog(const sptr<IRemoteObject> & callback,const AAFwk::WantParams & wantParams)1659 virtual int32_t RequestAssertFaultDialog(const sptr<IRemoteObject> &callback, const AAFwk::WantParams &wantParams) 1660 { 1661 return -1; 1662 } 1663 1664 /** 1665 * @brief Notify the operation status of the user. 1666 * @param assertFaultSessionId Indicates the request ID of AssertFault. 1667 * @param userStatus Operation status of the user. 1668 * @return Returns ERR_OK on success, others on failure. 1669 */ NotifyDebugAssertResult(uint64_t assertFaultSessionId,AAFwk::UserStatus userStatus)1670 virtual int32_t NotifyDebugAssertResult(uint64_t assertFaultSessionId, AAFwk::UserStatus userStatus) 1671 { 1672 return -1; 1673 } 1674 1675 /** 1676 * Starts a new ability with specific start options. 1677 * 1678 * @param want, the want of the ability to start. 1679 * @param startOptions Indicates the options used to start. 1680 * @return Returns ERR_OK on success, others on failure. 1681 */ StartShortcut(const Want & want,const StartOptions & startOptions)1682 virtual int32_t StartShortcut(const Want &want, const StartOptions &startOptions) 1683 { 1684 return 0; 1685 } 1686 1687 /** 1688 * Get ability state by persistent id. 1689 * 1690 * @param persistentId, the persistentId of the session. 1691 * @param state Indicates the ability state. 1692 * @return Returns ERR_OK on success, others on failure. 1693 */ GetAbilityStateByPersistentId(int32_t persistentId,bool & state)1694 virtual int32_t GetAbilityStateByPersistentId(int32_t persistentId, bool &state) 1695 { 1696 return 0; 1697 } 1698 1699 /** 1700 * Transfer resultCode & want to ability manager service. 1701 * 1702 * @param resultCode, the resultCode of the ability to terminate. 1703 * @param resultWant, the Want of the ability to return. 1704 * @return Returns ERR_OK on success, others on failure. 1705 */ TransferAbilityResultForExtension(const sptr<IRemoteObject> & callerToken,int32_t resultCode,const Want & want)1706 virtual int32_t TransferAbilityResultForExtension(const sptr<IRemoteObject> &callerToken, int32_t resultCode, 1707 const Want &want) 1708 { 1709 return 0; 1710 } 1711 1712 /** 1713 * Notify ability manager service frozen process. 1714 * 1715 * @param pidList, the pid list of the frozen process. 1716 * @param uid, the uid of the frozen process. 1717 */ NotifyFrozenProcessByRSS(const std::vector<int32_t> & pidList,int32_t uid)1718 virtual void NotifyFrozenProcessByRSS(const std::vector<int32_t> &pidList, int32_t uid) 1719 { 1720 return; 1721 } 1722 1723 /** 1724 * Request to clean UIAbility from user. 1725 * 1726 * @param sessionInfo the session info of the ability to clean. 1727 * @return Returns ERR_OK on success, others on failure. 1728 */ CleanUIAbilityBySCB(const sptr<SessionInfo> & sessionInfo)1729 virtual int32_t CleanUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo) 1730 { 1731 return 0; 1732 } 1733 1734 /** 1735 * Open atomic service window prior to finishing free install. 1736 * 1737 * @param bundleName, the bundle name of the atomic service. 1738 * @param moduleName, the module name of the atomic service. 1739 * @param abilityName, the ability name of the atomic service. 1740 * @param startTime, the starting time of the free install task. 1741 * @return Returns ERR_OK on success, others on failure. 1742 */ PreStartMission(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & startTime)1743 virtual int32_t PreStartMission(const std::string& bundleName, const std::string& moduleName, 1744 const std::string& abilityName, const std::string& startTime) 1745 { 1746 return 0; 1747 } 1748 1749 /** 1750 * Terminate the mission. 1751 * 1752 * @param missionId, The mission id of the UIAbility need to be terminated. 1753 * @return Returns ERR_OK on success, others on failure. 1754 */ TerminateMission(int32_t missionId)1755 virtual int32_t TerminateMission(int32_t missionId) 1756 { 1757 return 0; 1758 } 1759 1760 /** 1761 * update associate config list by rss. 1762 * 1763 * @param configs The rss config info. 1764 * @param exportConfigs The rss export config info. 1765 * @param flag UPDATE_CONFIG_FLAG_COVER is cover config, UPDATE_CONFIG_FLAG_APPEND is append config. 1766 */ UpdateAssociateConfigList(const std::map<std::string,std::list<std::string>> & configs,const std::list<std::string> & exportConfigs,int32_t flag)1767 virtual int32_t UpdateAssociateConfigList(const std::map<std::string, std::list<std::string>>& configs, 1768 const std::list<std::string>& exportConfigs, int32_t flag) 1769 { 1770 return 0; 1771 } 1772 1773 /** 1774 * Query preload uiextension record. 1775 * 1776 * @param element, The uiextension ElementName. 1777 * @param moduleName, The uiextension moduleName. 1778 * @param hostBundleName, The uiextension caller hostBundleName. 1779 * @param recordNum, The returned count of uiextension. 1780 * @param userId, The User Id. 1781 * @return Returns ERR_OK on success, others on failure. 1782 */ 1783 virtual int32_t QueryPreLoadUIExtensionRecord(const AppExecFwk::ElementName &element, 1784 const std::string &moduleName, 1785 const std::string &hostBundleName, 1786 int32_t &recordNum, 1787 int32_t userId = DEFAULT_INVAL_VALUE) 1788 { 1789 return 0; 1790 } 1791 }; 1792 } // namespace AAFwk 1793 } // namespace OHOS 1794 #endif // OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_INTERFACE_H 1795