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_PROXY_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_PROXY_H 18 19 #include "ability_manager_interface.h" 20 #include "auto_startup_info.h" 21 #include "iremote_proxy.h" 22 #include "mission_info.h" 23 24 namespace OHOS { 25 namespace AAFwk { 26 using AutoStartupInfo = AbilityRuntime::AutoStartupInfo; 27 /** 28 * @class AbilityManagerProxy 29 * AbilityManagerProxy. 30 */ 31 class AbilityManagerProxy : public IRemoteProxy<IAbilityManager> { 32 public: AbilityManagerProxy(const sptr<IRemoteObject> & impl)33 explicit AbilityManagerProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IAbilityManager>(impl) 34 {} 35 ~AbilityManagerProxy()36 virtual ~AbilityManagerProxy() 37 {} 38 39 /** 40 * StartAbility with want, send want to ability manager service. 41 * 42 * @param want, the want of the ability to start. 43 * @param requestCode, Ability request code. 44 * @param userId, Designation User ID. 45 * @return Returns ERR_OK on success, others on failure. 46 */ 47 virtual int StartAbility( 48 const Want &want, 49 int32_t userId = DEFAULT_INVAL_VALUE, 50 int requestCode = DEFAULT_INVAL_VALUE) override; 51 52 /** 53 * StartAbility with want, send want to ability manager service. 54 * 55 * @param want, the want of the ability to start. 56 * @param callerToken, caller ability token. 57 * @param requestCode the resultCode of the ability to start. 58 * @param userId, Designation User ID. 59 * @return Returns ERR_OK on success, others on failure. 60 */ 61 virtual int StartAbility( 62 const Want &want, 63 const sptr<IRemoteObject> &callerToken, 64 int32_t userId = DEFAULT_INVAL_VALUE, 65 int requestCode = DEFAULT_INVAL_VALUE) override; 66 67 /** 68 * StartAbilityWithSpecifyTokenId with want and specialId, send want to ability manager service. 69 * 70 * @param want, the want of the ability to start. 71 * @param callerToken, caller ability token. 72 * @param specialId the caller Id. 73 * @param userId, Designation User ID. 74 * @param requestCode the resultCode of the ability to start. 75 * @return Returns ERR_OK on success, others on failure. 76 */ 77 virtual int StartAbilityWithSpecifyTokenId( 78 const Want &want, 79 const sptr<IRemoteObject> &callerToken, 80 uint32_t specifyTokenId, 81 int32_t userId = DEFAULT_INVAL_VALUE, 82 int requestCode = DEFAULT_INVAL_VALUE) override; 83 84 /** 85 * StartAbility by insight intent, send want to ability manager service. 86 * 87 * @param want Ability want. 88 * @param callerToken caller ability token. 89 * @param intentId insight intent id. 90 * @param userId userId of target ability. 91 * @return Returns ERR_OK on success, others on failure. 92 */ 93 int32_t StartAbilityByInsightIntent( 94 const Want &want, 95 const sptr<IRemoteObject> &callerToken, 96 uint64_t intentId, 97 int32_t userId = DEFAULT_INVAL_VALUE) override; 98 99 /** 100 * Starts a new ability with specific start settings. 101 * 102 * @param want Indicates the ability to start. 103 * @param callerToken caller ability token. 104 * @param abilityStartSetting Indicates the setting ability used to start. 105 * @param userId, Designation User ID. 106 * @return Returns ERR_OK on success, others on failure. 107 */ 108 virtual int StartAbility( 109 const Want &want, 110 const AbilityStartSetting &abilityStartSetting, 111 const sptr<IRemoteObject> &callerToken, 112 int32_t userId = DEFAULT_INVAL_VALUE, 113 int requestCode = DEFAULT_INVAL_VALUE) override; 114 115 /** 116 * Starts a new ability with specific start options. 117 * 118 * @param want, the want of the ability to start. 119 * @param startOptions Indicates the options used to start. 120 * @param callerToken, caller ability token. 121 * @param userId, Designation User ID. 122 * @param requestCode the resultCode of the ability to start. 123 * @return Returns ERR_OK on success, others on failure. 124 */ 125 virtual int StartAbility( 126 const Want &want, 127 const StartOptions &startOptions, 128 const sptr<IRemoteObject> &callerToken, 129 int32_t userId = DEFAULT_INVAL_VALUE, 130 int requestCode = DEFAULT_INVAL_VALUE) override; 131 132 /** 133 * Starts a new ability using the original caller information. 134 * 135 * @param want the want of the ability to start. 136 * @param callerToken current caller ability token. 137 * @param asCallerSourceToken source caller ability token. 138 * @param userId Designation User ID. 139 * @param requestCode the resultCode of the ability to start. 140 * @return Returns ERR_OK on success, others on failure. 141 */ 142 virtual int StartAbilityAsCaller( 143 const Want &want, 144 const sptr<IRemoteObject> &callerToken, 145 sptr<IRemoteObject> asCallerSourceToken, 146 int32_t userId = DEFAULT_INVAL_VALUE, 147 int requestCode = DEFAULT_INVAL_VALUE) override; 148 149 /** 150 * Starts a new ability using the original caller information. 151 * 152 * @param want the want of the ability to start. 153 * @param startOptions Indicates the options used to start. 154 * @param callerToken current caller ability token. 155 * @param asCallerSourceToken source caller ability token. 156 * @param userId Designation User ID. 157 * @param requestCode the resultCode of the ability to start. 158 * @return Returns ERR_OK on success, others on failure. 159 */ 160 virtual int StartAbilityAsCaller( 161 const Want &want, 162 const StartOptions &startOptions, 163 const sptr<IRemoteObject> &callerToken, 164 sptr<IRemoteObject> asCallerSourceToken, 165 int32_t userId = DEFAULT_INVAL_VALUE, 166 int requestCode = DEFAULT_INVAL_VALUE) override; 167 168 /** 169 * Starts a new ability for result using the original caller information. 170 * 171 * @param want the want of the ability to start. 172 * @param callerToken current caller ability token. 173 * @param requestCode the resultCode of the ability to start. 174 * @param userId Designation User ID. 175 * @return Returns ERR_OK on success, others on failure. 176 */ 177 int StartAbilityForResultAsCaller( 178 const Want &want, 179 const sptr<IRemoteObject> &callerToken, 180 int requestCode = DEFAULT_INVAL_VALUE, 181 int32_t userId = DEFAULT_INVAL_VALUE) override; 182 183 /** 184 * Starts a new ability for result using the original caller information. 185 * 186 * @param want the want of the ability to start. 187 * @param startOptions Indicates the options used to start. 188 * @param callerToken current caller ability token. 189 * @param requestCode the resultCode of the ability to start. 190 * @param userId Designation User ID. 191 * @return Returns ERR_OK on success, others on failure. 192 */ 193 int StartAbilityForResultAsCaller( 194 const Want &want, 195 const StartOptions &startOptions, 196 const sptr<IRemoteObject> &callerToken, 197 int requestCode = DEFAULT_INVAL_VALUE, 198 int32_t userId = DEFAULT_INVAL_VALUE) override; 199 200 /** 201 * Start ui session ability with extension session info, send session info to ability manager service. 202 * 203 * @param want, the want of the ability to start. 204 * @param callerToken, caller ability token. 205 * @param sessionInfo the information of UIExtensionContentSession. 206 * @param userId, Designation User ID. 207 * @param requestCode, Ability request code. 208 * @return Returns ERR_OK on success, others on failure. 209 */ 210 virtual int StartAbilityByUIContentSession( 211 const Want &want, 212 const sptr<IRemoteObject> &callerToken, 213 const sptr<SessionInfo> &sessionInfo, 214 int32_t userId = DEFAULT_INVAL_VALUE, 215 int requestCode = DEFAULT_INVAL_VALUE) override; 216 217 /** 218 * Start ui session ability with extension session info, send session info to ability manager service. 219 * 220 * @param want, the want of the ability to start. 221 * @param startOptions Indicates the options used to start. 222 * @param callerToken, caller ability token. 223 * @param sessionInfo the information of UIExtensionContentSession. 224 * @param userId, Designation User ID. 225 * @param requestCode the resultCode of the ability to start. 226 * @return Returns ERR_OK on success, others on failure. 227 */ 228 virtual int StartAbilityByUIContentSession( 229 const Want &want, 230 const StartOptions &startOptions, 231 const sptr<IRemoteObject> &callerToken, 232 const sptr<SessionInfo> &sessionInfo, 233 int32_t userId = DEFAULT_INVAL_VALUE, 234 int requestCode = DEFAULT_INVAL_VALUE) override; 235 236 /** 237 * Start ui ability 238 * 239 * @param want the want of the ability to start. 240 * @param callerToken caller ability token. 241 * @param specifyTokenId The Caller ID. 242 * @return Returns ERR_OK on success, others on failure. 243 */ 244 virtual int StartAbilityOnlyUIAbility( 245 const Want &want, 246 const sptr<IRemoteObject> &callerToken, 247 uint32_t specifyTokenId) override; 248 249 /** 250 * Start extension ability with want, send want to ability manager service. 251 * 252 * @param want, the want of the ability to start. 253 * @param callerToken, caller ability token. 254 * @param userId, Designation User ID. 255 * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be started. 256 * @return Returns ERR_OK on success, others on failure. 257 */ 258 virtual int StartExtensionAbility( 259 const Want &want, 260 const sptr<IRemoteObject> &callerToken, 261 int32_t userId = DEFAULT_INVAL_VALUE, 262 AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED) override; 263 264 /** 265 * Create UIExtension with want, send want to ability manager service. 266 * 267 * @param want, the want of the ability to start. 268 * @return Returns ERR_OK on success, others on failure. 269 */ 270 int RequestModalUIExtension(const Want &want) override; 271 272 /** 273 * Preload UIExtension with want, send want to ability manager service. 274 * 275 * @param want, the want of the ability to start. 276 * @param hostBundleName, the caller application bundle name. 277 * @param userId, the extension runs in. 278 * @return Returns ERR_OK on success, others on failure. 279 */ 280 int PreloadUIExtensionAbility(const Want &want, std::string &hostBundleName, 281 int32_t userId = DEFAULT_INVAL_VALUE) override; 282 283 int ChangeAbilityVisibility(sptr<IRemoteObject> token, bool isShow) override; 284 285 int ChangeUIAbilityVisibilityBySCB(sptr<SessionInfo> sessionInfo, bool isShow) override; 286 /** 287 * Start ui extension ability with extension session info, send extension session info to ability manager service. 288 * 289 * @param extensionSessionInfo the extension session info of the ability to start. 290 * @param userId, Designation User ID. 291 * @return Returns ERR_OK on success, others on failure. 292 */ 293 virtual int StartUIExtensionAbility( 294 const sptr<SessionInfo> &extensionSessionInfo, 295 int32_t userId = DEFAULT_INVAL_VALUE) override; 296 297 /** 298 * Start ui ability with want, send want to ability manager service. 299 * 300 * @param sessionInfo the session info of the ability to start. 301 * @param isColdStart the session info of the ability is or not cold start. 302 * @return Returns ERR_OK on success, others on failure. 303 */ 304 virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0) override; 305 306 /** 307 * Stop extension ability with want, send want to ability manager service. 308 * 309 * @param want, the want of the ability to stop. 310 * @param callerToken, caller ability token. 311 * @param userId, Designation User ID. 312 * @param extensionType If an ExtensionAbilityType is set, only extension of that type can be stopped. 313 * @return Returns ERR_OK on success, others on failure. 314 */ 315 virtual int StopExtensionAbility( 316 const Want& want, 317 const sptr<IRemoteObject>& callerToken, 318 int32_t userId = DEFAULT_INVAL_VALUE, 319 AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED) override; 320 /** 321 * TerminateAbility, terminate the special ability. 322 * 323 * @param token, the token of the ability to terminate. 324 * @param resultCode, the resultCode of the ability to terminate. 325 * @param resultWant, the Want of the ability to return. 326 * @return Returns ERR_OK on success, others on failure. 327 */ 328 virtual int TerminateAbility( 329 const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) override; 330 331 /** 332 * BackToCallerAbilityWithResult, return to the caller ability. 333 * 334 * @param token, the token of the ability to terminate. 335 * @param resultCode, the resultCode of the ability to terminate. 336 * @param resultWant, the Want of the ability to return. 337 * @param callerRequestCode, the requestCode of caller ability. 338 * @return Returns ERR_OK on success, others on failure. 339 */ 340 virtual int BackToCallerAbilityWithResult(const sptr<IRemoteObject> &token, int resultCode, 341 const Want *resultWant, int64_t callerRequestCode) override; 342 343 /** 344 * TerminateUIServiceExtensionAbility, terminate UIServiceExtensionAbility. 345 * 346 * @param token, the token of the UIServiceExtensionAbility to terminate. 347 * @return Returns ERR_OK on success, others on failure. 348 */ 349 virtual int32_t TerminateUIServiceExtensionAbility(const sptr<IRemoteObject> &token) override; 350 351 /** 352 * TerminateUIExtensionAbility, terminate the special ui extension ability. 353 * 354 * @param extensionSessionInfo the extension session info of the ability to terminate. 355 * @param resultCode resultCode. 356 * @param Want Ability want returned. 357 * @return Returns ERR_OK on success, others on failure. 358 */ 359 virtual int TerminateUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo, int resultCode, 360 const Want *resultWant) override; 361 362 /** 363 * CloseUIExtensionAbilityBySCB, terminate the specified ui extension ability by SCB. 364 * 365 * @param token the ability token. 366 * @return Returns ERR_OK on success, others on failure. 367 */ 368 int CloseUIExtensionAbilityBySCB(const sptr<IRemoteObject> token) override; 369 370 /** 371 * CloseUIAbilityBySCB, close the special ability by scb. 372 * 373 * @param sessionInfo the session info of the ability to terminate. 374 * @return Returns ERR_OK on success, others on failure. 375 */ 376 virtual int CloseUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo) override; 377 378 /** 379 * SendResultToAbility with want, return want from ability manager service.(Only used for dms) 380 * 381 * @param requestCode, request code. 382 * @param resultCode, resultCode to return. 383 * @param resultWant, the Want of the ability to return. 384 * @return Returns ERR_OK on success, others on failure. 385 */ 386 virtual int SendResultToAbility(int32_t requestCode, int32_t resultCode, Want& resultWant) override; 387 388 /** 389 * MoveAbilityToBackground. 390 * 391 * @param token, the token of the ability to move. 392 * @return Returns ERR_OK on success, others on failure. 393 */ 394 virtual int MoveAbilityToBackground(const sptr<IRemoteObject> &token) override; 395 396 /** 397 * Move the UIAbility to background, called by app self. 398 * 399 * @param token the token of the ability to move. 400 * @return Returns ERR_OK on success, others on failure. 401 */ 402 virtual int32_t MoveUIAbilityToBackground(const sptr<IRemoteObject> token) override; 403 404 /** 405 * CloseAbility, close the special ability. 406 * 407 * @param token, the token of the ability to terminate. 408 * @param resultCode, the resultCode of the ability to terminate. 409 * @param resultWant, the Want of the ability to return. 410 * @return Returns ERR_OK on success, others on failure. 411 */ 412 virtual int CloseAbility( 413 const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant = nullptr) override; 414 415 /** 416 * MinimizeAbility, minimize the special ability. 417 * 418 * @param token, ability token. 419 * @param fromUser mark the minimize operation source. 420 * @return Returns ERR_OK on success, others on failure. 421 */ 422 virtual int MinimizeAbility(const sptr<IRemoteObject> &token, bool fromUser = false) override; 423 424 /** 425 * MinimizeUIExtensionAbility, minimize the special ui extension ability. 426 * 427 * @param extensionSessionInfo the extension session info of the ability to minimize. 428 * @param fromUser mark the minimize operation source. 429 * @return Returns ERR_OK on success, others on failure. 430 */ 431 virtual int MinimizeUIExtensionAbility(const sptr<SessionInfo> &extensionSessionInfo, 432 bool fromUser = false) override; 433 434 /** 435 * MinimizeUIAbilityBySCB, minimize the special ability by scb. 436 * 437 * @param sessionInfo the session info of the ability to minimize. 438 * @param fromUser, Whether form user. 439 * @return Returns ERR_OK on success, others on failure. 440 */ 441 virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false, 442 uint32_t sceneFlag = 0) override; 443 444 /** 445 * ConnectAbility, connect session with service ability. 446 * 447 * @param want, Special want for service type's ability. 448 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 449 * @param callerToken, caller ability token. 450 * @param userId, Designation User ID. 451 * @return Returns ERR_OK on success, others on failure. 452 */ 453 virtual int ConnectAbility( 454 const Want &want, 455 const sptr<IAbilityConnection> &connect, 456 const sptr<IRemoteObject> &callerToken, 457 int32_t userId = DEFAULT_INVAL_VALUE) override; 458 459 virtual int ConnectAbilityCommon( 460 const Want &want, 461 const sptr<IAbilityConnection> &connect, 462 const sptr<IRemoteObject> &callerToken, 463 AppExecFwk::ExtensionAbilityType extensionType, 464 int32_t userId = DEFAULT_INVAL_VALUE, 465 bool isQueryExtensionOnly = false) override; 466 467 virtual int ConnectUIExtensionAbility( 468 const Want &want, 469 const sptr<IAbilityConnection> &connect, 470 const sptr<SessionInfo> &sessionInfo, 471 int32_t userId = DEFAULT_INVAL_VALUE, 472 sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr) override; 473 474 /** 475 * DisconnectAbility, connect session with service ability. 476 * 477 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 478 * @return Returns ERR_OK on success, others on failure. 479 */ 480 virtual int DisconnectAbility(sptr<IAbilityConnection> connect) override; 481 482 /** 483 * AcquireDataAbility, acquire a data ability by its authority, if it not existed, 484 * AMS loads it synchronously. 485 * 486 * @param uri, data ability uri. 487 * @param isKill, true: when a data ability is died, ams will kill this client, or do nothing. 488 * @param callerToken, specifies the caller ability token. 489 * @return returns the data ability ipc object, or nullptr for failed. 490 */ 491 virtual sptr<IAbilityScheduler> AcquireDataAbility( 492 const Uri &uri, bool isKill, const sptr<IRemoteObject> &callerToken) override; 493 494 /** 495 * ReleaseDataAbility, release the data ability that referenced by 'dataAbilityToken'. 496 * 497 * @param dataAbilityScheduler, specifies the data ability that will be released. 498 * @param callerToken, specifies the caller ability token. 499 * @return returns ERR_OK if succeeded, or error codes for failed. 500 */ 501 virtual int ReleaseDataAbility( 502 sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) override; 503 504 /** 505 * AttachAbilityThread, ability call this interface after loaded. 506 * 507 * @param scheduler,.the interface handler of kit ability. 508 * @param token,.ability's token. 509 * @return Returns ERR_OK on success, others on failure. 510 */ 511 virtual int AttachAbilityThread( 512 const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) override; 513 514 /** 515 * AbilityTransitionDone, ability call this interface after lift cycle was changed. 516 * 517 * @param token,.ability's token. 518 * @param state,.the state of ability lift cycle. 519 * @return Returns ERR_OK on success, others on failure. 520 */ 521 virtual int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) override; 522 523 /** 524 * AbilityWindowConfigTransitionDone, ability call this interface after lift cycle was changed. 525 * 526 * @param token,.ability's token. 527 * @return Returns ERR_OK on success, others on failure. 528 */ 529 virtual int AbilityWindowConfigTransitionDone( 530 const sptr<IRemoteObject> &token, const WindowConfig &windowConfig) override; 531 532 /** 533 * ScheduleConnectAbilityDone, service ability call this interface while session was connected. 534 * 535 * @param token,.service ability's token. 536 * @param remoteObject,.the session proxy of service ability. 537 * @return Returns ERR_OK on success, others on failure. 538 */ 539 virtual int ScheduleConnectAbilityDone( 540 const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) override; 541 542 /** 543 * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected. 544 * 545 * @param token,.service ability's token. 546 * @return Returns ERR_OK on success, others on failure. 547 */ 548 virtual int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) override; 549 550 /** 551 * ScheduleCommandAbilityDone, service ability call this interface while session was commanded. 552 * 553 * @param token,.service ability's token. 554 * @return Returns ERR_OK on success, others on failure. 555 */ 556 virtual int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) override; 557 558 virtual int ScheduleCommandAbilityWindowDone( 559 const sptr<IRemoteObject> &token, 560 const sptr<SessionInfo> &sessionInfo, 561 WindowCommand winCmd, 562 AbilityCommand abilityCmd) override; 563 564 /** 565 * dump ability stack info, about userID, mission stack info, 566 * mission record info and ability info. 567 * 568 * @param state Ability stack info. 569 * @return Returns ERR_OK on success, others on failure. 570 */ 571 virtual void DumpState(const std::string &args, std::vector<std::string> &state) override; 572 virtual void DumpSysState( 573 const std::string& args, std::vector<std::string>& state, bool isClient, bool isUserID, int UserID) override; 574 575 /** 576 * Destroys this Service ability by Want. 577 * 578 * @param want, Special want for service type's ability. 579 * @param token ability's token. 580 * @return Returns true if this Service ability will be destroyed; returns false otherwise. 581 */ 582 virtual int StopServiceAbility(const Want &want, int32_t userId = DEFAULT_INVAL_VALUE, 583 const sptr<IRemoteObject> &token = nullptr) override; 584 585 /** 586 * Get top ability. 587 * 588 * @param isNeedLocalDeviceId is need local device id. 589 * @return Returns front desk focus ability elementName. 590 */ 591 virtual AppExecFwk::ElementName GetTopAbility(bool isNeedLocalDeviceId = true) override; 592 593 /** 594 * Get element name by token. 595 * 596 * @param token ability's token. 597 * @param isNeedLocalDeviceId is need local device id. 598 * @return Returns front desk focus ability elementName by token. 599 */ 600 virtual AppExecFwk::ElementName GetElementNameByToken(sptr<IRemoteObject> token, 601 bool isNeedLocalDeviceId = true) override; 602 603 /** 604 * Kill the process immediately. 605 * 606 * @param bundleName. 607 * @return Returns ERR_OK on success, others on failure. 608 */ 609 virtual int KillProcess(const std::string &bundleName, const bool clearPageStack = true) override; 610 611 #ifdef ABILITY_COMMAND_FOR_TEST 612 /** 613 * force timeout ability. 614 * 615 * @param abilityName. 616 * @param state. 617 * @return Returns ERR_OK on success, others on failure. 618 */ 619 virtual int ForceTimeoutForTest(const std::string &abilityName, const std::string &state) override; 620 #endif 621 622 /** 623 * Uninstall app 624 * 625 * @param bundleName bundle name of uninstalling app. 626 * @param uid uid of bundle. 627 * @return Returns ERR_OK on success, others on failure. 628 */ 629 virtual int UninstallApp(const std::string &bundleName, int32_t uid) override; 630 631 /** 632 * Uninstall app 633 * 634 * @param bundleName bundle name of uninstalling app. 635 * @param uid uid of bundle. 636 * @param appIndex the app index of app clone. 637 * @return Returns ERR_OK on success, others on failure. 638 */ 639 virtual int32_t UninstallApp(const std::string &bundleName, int32_t uid, int32_t appIndex) override; 640 641 /** 642 * Upgrade app, record exit reason and kill application 643 * 644 * @param bundleName bundle name of upgrading app. 645 * @param uid uid of bundle. 646 * @param exitMsg the exit reason message. 647 * @param appIndex the app index of app clone. 648 * @return Returns ERR_OK on success, others on failure. 649 */ 650 virtual int32_t UpgradeApp(const std::string &bundleName, const int32_t uid, const std::string &exitMsg, 651 int32_t appIndex = 0) override; 652 653 virtual sptr<IWantSender> GetWantSender( 654 const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid = -1) override; 655 656 virtual int SendWantSender(sptr<IWantSender> target, const SenderInfo &senderInfo) override; 657 658 virtual void CancelWantSender(const sptr<IWantSender> &sender) override; 659 660 virtual int GetPendingWantUid(const sptr<IWantSender> &target) override; 661 662 virtual int GetPendingWantUserId(const sptr<IWantSender> &target) override; 663 664 virtual std::string GetPendingWantBundleName(const sptr<IWantSender> &target) override; 665 666 virtual int GetPendingWantCode(const sptr<IWantSender> &target) override; 667 668 virtual int GetPendingWantType(const sptr<IWantSender> &target) override; 669 670 virtual void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) override; 671 672 virtual void UnregisterCancelListener( 673 const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver) override; 674 675 virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) override; 676 677 virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) override; 678 679 virtual int GetAppMemorySize() override; 680 681 virtual bool IsRamConstrainedDevice() override; 682 virtual int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId, 683 int32_t missionId, const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) override; 684 685 virtual int ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo, 686 const sptr<IRemoteObject> &callback) override; 687 688 virtual int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) override; 689 690 virtual int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) override; 691 692 virtual void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) override; 693 694 virtual int NotifyContinuationResult(int32_t missionId, int32_t result) override; 695 696 virtual int StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override; 697 698 virtual int StopSyncRemoteMissions(const std::string& devId) override; 699 700 virtual int LockMissionForCleanup(int32_t missionId) override; 701 702 virtual int UnlockMissionForCleanup(int32_t missionId) override; 703 704 virtual void SetLockedState(int32_t sessionId, bool lockedState) override; 705 706 virtual int RegisterMissionListener(const sptr<IMissionListener> &listener) override; 707 708 virtual int UnRegisterMissionListener(const sptr<IMissionListener> &listener) override; 709 710 virtual int GetMissionInfos(const std::string& deviceId, int32_t numMax, 711 std::vector<MissionInfo> &missionInfos) override; 712 713 virtual int GetMissionInfo(const std::string& deviceId, int32_t missionId, 714 MissionInfo &missionInfos) override; 715 716 virtual int CleanMission(int32_t missionId) override; 717 718 virtual int CleanAllMissions() override; 719 720 virtual int MoveMissionToFront(int32_t missionId) override; 721 722 virtual int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) override; 723 724 virtual int MoveMissionsToForeground(const std::vector<int32_t>& missionIds, int32_t topMissionId) override; 725 726 virtual int MoveMissionsToBackground(const std::vector<int32_t>& missionIds, 727 std::vector<int32_t>& result) override; 728 729 /** 730 * Start Ability, connect session with common ability. 731 * 732 * @param want, Special want for service type's ability. 733 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 734 * @param accountId Indicates the account to start. 735 * @return Returns ERR_OK on success, others on failure. 736 */ 737 virtual int StartAbilityByCall(const Want &want, const sptr<IAbilityConnection> &connect, 738 const sptr<IRemoteObject> &callerToken, int32_t accountId = DEFAULT_INVAL_VALUE) override; 739 740 /** 741 * CallRequestDone, after invoke callRequest, ability will call this interface to return callee. 742 * 743 * @param token, ability's token. 744 * @param callStub, ability's callee. 745 */ 746 void CallRequestDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &callStub) override; 747 748 /** 749 * Release the call between Ability, disconnect session with common ability. 750 * 751 * @param connect, Callback used to notify caller the result of connecting or disconnecting. 752 * @param element, the element of target service. 753 * @return Returns ERR_OK on success, others on failure. 754 */ 755 virtual int ReleaseCall( 756 const sptr<IAbilityConnection> &connect, const AppExecFwk::ElementName &element) override; 757 758 virtual int StartUser(int userId, sptr<IUserCallback> callback) override; 759 760 virtual int StopUser(int userId, const sptr<IUserCallback> &callback) override; 761 762 virtual int LogoutUser(int32_t userId) override; 763 764 virtual int SetMissionContinueState(const sptr<IRemoteObject> &token, const AAFwk::ContinueState &state) override; 765 766 #ifdef SUPPORT_GRAPHICS 767 virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) override; 768 769 virtual int SetMissionIcon(const sptr<IRemoteObject> &token, 770 const std::shared_ptr<OHOS::Media::PixelMap> &icon) override; 771 772 virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler, 773 bool animationEnabled) override; 774 775 virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) override; 776 777 virtual void CompleteFirstFrameDrawing(int32_t sessionId) override; 778 779 virtual int PrepareTerminateAbility( 780 const sptr<IRemoteObject> &token, sptr<IPrepareTerminateCallback> &callback) override; 781 782 virtual int GetDialogSessionInfo(const std::string &dialogSessionId, sptr<DialogSessionInfo> &info) override; 783 784 virtual int SendDialogResult(const Want &want, const std::string &dialogSessionId, bool isAllow) override; 785 786 virtual int RegisterAbilityFirstFrameStateObserver(const sptr<IAbilityFirstFrameStateObserver> &observer, 787 const std::string &targetBundleName) override; 788 789 virtual int UnregisterAbilityFirstFrameStateObserver( 790 const sptr<IAbilityFirstFrameStateObserver> &observer) override; 791 #endif 792 793 virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) override; 794 795 virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) override; 796 797 virtual int GetProcessRunningInfos(std::vector<AppExecFwk::RunningProcessInfo> &info) override; 798 799 virtual int RegisterMissionListener(const std::string &deviceId, 800 const sptr<IRemoteMissionListener> &listener) override; 801 802 virtual int RegisterOnListener(const std::string &type, 803 const sptr<IRemoteOnListener> &listener) override; 804 805 virtual int RegisterOffListener(const std::string &deviceId, 806 const sptr<IRemoteOnListener> &listener) override; 807 808 virtual int UnRegisterMissionListener(const std::string &deviceId, 809 const sptr<IRemoteMissionListener> &listener) override; 810 811 /** 812 * Set ability controller. 813 * 814 * @param abilityController, The ability controller. 815 * @return Returns ERR_OK on success, others on failure. 816 */ 817 virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController, 818 bool imAStabilityTest) override; 819 820 /** 821 * Is user a stability test. 822 * 823 * @return Returns true if user is a stability test. 824 */ 825 virtual bool IsRunningInStabilityTest() override; 826 827 virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override; 828 829 virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, 830 MissionSnapshot& snapshot, bool isLowResolution) override; 831 832 virtual int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) override; 833 834 virtual int FinishUserTest( 835 const std::string &msg, const int64_t &resultCode, const std::string &bundleName) override; 836 837 /** 838 * GetTopAbility, get the token of top ability. 839 * 840 * @param token, the token of top ability. 841 * @return Returns ERR_OK on success, others on failure. 842 */ 843 virtual int GetTopAbility(sptr<IRemoteObject> &token) override; 844 845 virtual int CheckUIExtensionIsFocused(uint32_t uiExtensionTokenId, bool& isFocused) override; 846 847 /** 848 * The delegator calls this interface to move the ability to the foreground. 849 * 850 * @param token, ability's token. 851 * @return Returns ERR_OK on success, others on failure. 852 */ 853 virtual int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) override; 854 855 /** 856 * The delegator calls this interface to move the ability to the background. 857 * 858 * @param token, ability's token. 859 * @return Returns ERR_OK on success, others on failure. 860 */ 861 virtual int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) override; 862 863 /** 864 * Calls this interface to move the ability to the foreground. 865 * 866 * @param token, ability's token. 867 * @param flag, use for lock or unlock flag and so on. 868 * @return Returns ERR_OK on success, others on failure. 869 */ 870 virtual int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) override; 871 872 /** 873 * Calls this interface to move the ability to the background. 874 * 875 * @param token, ability's token. 876 * @param flag, use for lock or unlock flag and so on. 877 * @return Returns ERR_OK on success, others on failure. 878 */ 879 virtual int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) override; 880 881 /** 882 * Get mission id by ability token. 883 * 884 * @param token The token of ability. 885 * @return Returns -1 if do not find mission, otherwise return mission id. 886 */ 887 virtual int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) override; 888 889 /** 890 * Get ability token by connect. 891 * 892 * @param token The token of ability. 893 * @param callStub The callee object. 894 */ 895 void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) override; 896 897 /** 898 * Call free install from remote. 899 * 900 * @param want, the want of the ability to start. 901 * @param userId, Designation User ID. 902 * @param requestCode, Ability request code. 903 * @param callback, Callback from remote. 904 * @return Returns ERR_OK on success, others on failure. 905 */ 906 virtual int FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback, 907 int32_t userId, int requestCode = DEFAULT_INVAL_VALUE) override; 908 909 /** 910 * Add FreeInstall Observer 911 * 912 * @param observer the observer of ability free install start. 913 * @return Returns ERR_OK on success, others on failure. 914 */ 915 virtual int AddFreeInstallObserver(const sptr<IRemoteObject> &callerToken, 916 const sptr<AbilityRuntime::IFreeInstallObserver> &observer) override; 917 918 /** 919 * Called when client complete dump. 920 * 921 * @param infos The dump info. 922 * @return Returns ERR_OK on success, others on failure. 923 */ 924 virtual int DumpAbilityInfoDone(std::vector<std::string> &infos, const sptr<IRemoteObject> &callerToken) override; 925 926 /** 927 * Called to update mission snapshot. 928 * @param token The target ability. 929 * @param pixelMap The snapshot. 930 */ 931 virtual void UpdateMissionSnapShot(const sptr<IRemoteObject> &token, 932 const std::shared_ptr<Media::PixelMap> &pixelMap) override; 933 virtual void EnableRecoverAbility(const sptr<IRemoteObject>& token) override; 934 virtual void SubmitSaveRecoveryInfo(const sptr<IRemoteObject>& token) override; 935 virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason, 936 const Want *want = nullptr) override; 937 938 virtual void ScheduleClearRecoveryPageStack() override; 939 940 /** 941 * Called to verify that the MissionId is valid. 942 * @param missionIds Query mission list. 943 * @param results Output parameters, return results up to 20 query results. 944 * @return Returns ERR_OK on success, others on failure. 945 */ 946 int32_t IsValidMissionIds( 947 const std::vector<int32_t> &missionIds, std::vector<MissionValidResult> &results) override; 948 949 /** 950 * Query whether the application of the specified PID and UID has been granted a certain permission 951 * @param permission 952 * @param pid Process id 953 * @param uid 954 * @return Returns ERR_OK if the current process has the permission, others on failure. 955 */ 956 virtual int VerifyPermission(const std::string &permission, int pid, int uid) override; 957 958 /** 959 * Request dialog service with want, send want to ability manager service. 960 * 961 * @param want, the want of the dialog service to start. 962 * @param callerToken, caller ability token. 963 * @return Returns ERR_OK on success, others on failure. 964 */ 965 virtual int32_t RequestDialogService(const Want &want, const sptr<IRemoteObject> &callerToken) override; 966 967 int32_t ReportDrawnCompleted(const sptr<IRemoteObject> &callerToken) override; 968 969 virtual int32_t AcquireShareData( 970 const int32_t &missionId, const sptr<IAcquireShareDataCallback> &shareData) override; 971 virtual int32_t ShareDataDone(const sptr<IRemoteObject> &token, 972 const int32_t &resultCode, const int32_t &uniqueId, WantParams &wantParam) override; 973 974 /** 975 * Force app exit and record exit reason. 976 * @param pid Process id . 977 * @param exitReason The reason of app exit. 978 * @return Returns ERR_OK on success, others on failure. 979 */ 980 virtual int32_t ForceExitApp(const int32_t pid, const ExitReason &exitReason) override; 981 982 /** 983 * Record app exit reason. 984 * @param exitReason The reason of app exit. 985 * @return Returns ERR_OK on success, others on failure. 986 */ 987 virtual int32_t RecordAppExitReason(const ExitReason &exitReason) override; 988 989 /** 990 * Record the process exit reason before the process being killed. 991 * @param pid The process id. 992 * @param exitReason The reason of process exit. 993 * @return Returns ERR_OK on success, others on failure. 994 */ 995 virtual int32_t RecordProcessExitReason(const int32_t pid, const ExitReason &exitReason) override; 996 997 /** 998 * Set rootSceneSession by SCB. 999 * 1000 * @param rootSceneSession Indicates root scene session of SCB. 1001 */ 1002 virtual void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession) override; 1003 1004 /** 1005 * Call UIAbility by SCB. 1006 * 1007 * @param sessionInfo the session info of the ability to be called. 1008 * @param isColdStart the session of the ability is or not cold start. 1009 */ 1010 virtual void CallUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isColdStart) override; 1011 1012 /** 1013 * Start specified ability by SCB. 1014 * 1015 * @param want Want information. 1016 */ 1017 void StartSpecifiedAbilityBySCB(const Want &want) override; 1018 1019 /** 1020 * Notify sandbox app the result of saving file. 1021 * @param want Result of saving file, which contains the file's uri if success. 1022 * @param resultCode Indicates the action's result. 1023 * @param requestCode Pass the requestCode to match request. 1024 * @return Returns ERR_OK on success, others on failure. 1025 */ 1026 virtual int32_t NotifySaveAsResult(const Want &want, int resultCode, int requestCode) override; 1027 1028 /** 1029 * Set sessionManagerService 1030 * @param sessionManagerService the point of sessionManagerService. 1031 * 1032 * @return Returns ERR_OK on success, others on failure. 1033 */ 1034 virtual int32_t SetSessionManagerService(const sptr<IRemoteObject> &sessionManagerService) override; 1035 1036 /** 1037 * @brief Register collaborator. 1038 * @param type collaborator type. 1039 * @param impl collaborator. 1040 * @return 0 or else. 1041 */ 1042 virtual int32_t RegisterIAbilityManagerCollaborator( 1043 int32_t type, const sptr<IAbilityManagerCollaborator> &impl) override; 1044 1045 /** 1046 * @brief Unregister collaborator. 1047 * @param type collaborator type. 1048 * @return 0 or else. 1049 */ 1050 virtual int32_t UnregisterIAbilityManagerCollaborator(int32_t type) override; 1051 1052 virtual int32_t RegisterStatusBarDelegate(sptr<AbilityRuntime::IStatusBarDelegate> delegate) override; 1053 1054 virtual int32_t KillProcessWithPrepareTerminate(const std::vector<int32_t>& pids) override; 1055 1056 /** 1057 * @brief Register auto start up callback for system api. 1058 * @param callback The point of JsAbilityAutoStartupCallBack. 1059 * @return Returns ERR_OK on success, others on failure. 1060 */ 1061 virtual int32_t RegisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback) override; 1062 1063 /** 1064 * @brief Unregister auto start up callback for system api. 1065 * @param callback The point of JsAbilityAutoStartupCallBack. 1066 * @return Returns ERR_OK on success, others on failure. 1067 */ 1068 virtual int32_t UnregisterAutoStartupSystemCallback(const sptr<IRemoteObject> &callback) override; 1069 1070 /** 1071 * @brief Set every application auto start up state. 1072 * @param info The auto startup info,include bundle name, module name, ability name. 1073 * @return Returns ERR_OK on success, others on failure. 1074 */ 1075 virtual int32_t SetApplicationAutoStartup(const AutoStartupInfo &info) override; 1076 1077 /** 1078 * @brief Cancel every application auto start up . 1079 * @param info The auto startup info,include bundle name, module name, ability name. 1080 * @return Returns ERR_OK on success, others on failure. 1081 */ 1082 virtual int32_t CancelApplicationAutoStartup(const AutoStartupInfo &info) override; 1083 1084 /** 1085 * @brief Query auto startup state all application. 1086 * @param infoList Output parameters, return auto startup info list. 1087 * @return Returns ERR_OK on success, others on failure. 1088 */ 1089 virtual int32_t QueryAllAutoStartupApplications(std::vector<AutoStartupInfo> &infoList) override; 1090 1091 /** 1092 * PrepareTerminateAbilityBySCB, prepare to terminate ability by scb. 1093 * 1094 * @param sessionInfo the session info of the ability to start. 1095 * @param isPrepareTerminate the result of ability onPrepareToTermiante. 1096 * @return Returns ERR_OK on success, others on failure. 1097 */ 1098 virtual int PrepareTerminateAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool &isPrepareTerminate) override; 1099 virtual int RegisterSessionHandler(const sptr<IRemoteObject> &object) override; 1100 1101 /** 1102 * @brief Register app debug listener. 1103 * @param listener App debug listener. 1104 * @return Returns ERR_OK on success, others on failure. 1105 */ 1106 int32_t RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) override; 1107 1108 /** 1109 * @brief Unregister app debug listener. 1110 * @param listener App debug listener. 1111 * @return Returns ERR_OK on success, others on failure. 1112 */ 1113 int32_t UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) override; 1114 1115 /** 1116 * @brief Attach app debug. 1117 * @param bundleName The application bundle name. 1118 * @return Returns ERR_OK on success, others on failure. 1119 */ 1120 int32_t AttachAppDebug(const std::string &bundleName) override; 1121 1122 /** 1123 * @brief Detach app debug. 1124 * @param bundleName The application bundle name. 1125 * @return Returns ERR_OK on success, others on failure. 1126 */ 1127 int32_t DetachAppDebug(const std::string &bundleName) override; 1128 1129 /** 1130 * @brief Execute intent. 1131 * @param key The key of intent executing client. 1132 * @param callerToken Caller ability token. 1133 * @param param The Intent execute param. 1134 * @return Returns ERR_OK on success, others on failure. 1135 */ 1136 int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken, 1137 const InsightIntentExecuteParam ¶m) override; 1138 1139 /** 1140 * @brief Check if ability controller can start. 1141 * @param want The want of ability to start. 1142 * @return Return true to allow ability to start, or false to reject. 1143 */ 1144 virtual bool IsAbilityControllerStart(const Want &want) override; 1145 1146 /** 1147 * @brief Called when insight intent execute finished. 1148 * 1149 * @param token ability's token. 1150 * @param intentId insight intent id. 1151 * @param result insight intent execute result. 1152 * @return Returns ERR_OK on success, others on failure. 1153 */ 1154 int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId, 1155 const InsightIntentExecuteResult &result) override; 1156 1157 /** 1158 * @brief Set application auto start up state by EDM. 1159 * @param info The auto startup info, include bundle name, module name, ability name. 1160 * @param flag Indicate whether to allow the application to change the auto start up state. 1161 * @return Returns ERR_OK on success, others on failure. 1162 */ 1163 int32_t SetApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) override; 1164 1165 /** 1166 * @brief Cancel application auto start up state by EDM. 1167 * @param info The auto startup info, include bundle name, module name, ability name. 1168 * @param flag Indicate whether to allow the application to change the auto start up state. 1169 * @return Returns ERR_OK on success, others on failure. 1170 */ 1171 int32_t CancelApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) override; 1172 1173 /** 1174 * @brief Get foreground ui abilities. 1175 * @param list Foreground ui abilities. 1176 * @return Returns ERR_OK on success, others on failure. 1177 */ 1178 int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) override; 1179 1180 /** 1181 * @brief Open file by uri. 1182 * @param uri The file uri. 1183 * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION. 1184 * @return int The file descriptor. 1185 */ 1186 virtual int32_t OpenFile(const Uri& uri, uint32_t flag) override; 1187 1188 /** 1189 * @brief Update session info. 1190 * @param sessionInfos The vector of session info. 1191 */ 1192 virtual int32_t UpdateSessionInfoBySCB(std::list<SessionInfo> &sessionInfos, int32_t userId, 1193 std::vector<int32_t> &sessionIds) override; 1194 1195 /** 1196 * @brief Restart app self. 1197 * @param want The ability type must be UIAbility. 1198 * @param isAppRecovery True indicates that the app is restarted because of recovery. 1199 * @return Returns ERR_OK on success, others on failure. 1200 */ 1201 int32_t RestartApp(const AAFwk::Want &want, bool isAppRecovery = false) override; 1202 1203 /** 1204 * @brief Get host info of root caller. 1205 * 1206 * @param token The ability token. 1207 * @param hostInfo The host info of root caller. 1208 * @param userId The user id. 1209 * @return int32_t Returns 0 on success, others on failure. 1210 */ 1211 int32_t GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token, UIExtensionHostInfo &hostInfo, 1212 int32_t userId = DEFAULT_INVAL_VALUE) override; 1213 1214 /** 1215 * @brief Get ui extension session info 1216 * 1217 * @param token The ability token. 1218 * @param uiExtensionSessionInfo The ui extension session info. 1219 * @param userId The user id. 1220 * @return int32_t Returns ERR_OK on success, others on failure. 1221 */ 1222 int32_t GetUIExtensionSessionInfo(const sptr<IRemoteObject> token, UIExtensionSessionInfo &uiExtensionSessionInfo, 1223 int32_t userId = DEFAULT_INVAL_VALUE) override; 1224 1225 /** 1226 * @brief Pop-up launch of full-screen atomic service. 1227 * @param want The want with parameters. 1228 * @param callerToken caller ability token. 1229 * @param requestCode Ability request code. 1230 * @param userId The User ID. 1231 * @return Returns ERR_OK on success, others on failure. 1232 */ 1233 virtual int32_t OpenAtomicService(Want& want, const StartOptions &options, sptr<IRemoteObject> callerToken, 1234 int32_t requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE) override; 1235 1236 /** 1237 * @brief Querying whether to allow embedded startup of atomic service. 1238 * 1239 * @param token The caller UIAbility token. 1240 * @param appId The ID of the application to which this bundle belongs. 1241 * @return Returns true to allow ability to start, or false to reject. 1242 */ 1243 virtual bool IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId) override; 1244 1245 /** 1246 * Set the enable status for starting and stopping resident processes. 1247 * The caller application can only set the resident status of the configured process. 1248 * @param bundleName The bundle name of the resident process. 1249 * @param enable Set resident process enable status. 1250 * @return Returns ERR_OK on success, others on failure. 1251 */ 1252 int32_t SetResidentProcessEnabled(const std::string &bundleName, bool enable) override; 1253 1254 /** 1255 * @brief Request to display assert fault dialog. 1256 * @param callback Listen for user operation callbacks. 1257 * @param wantParams Assert dialog box display information. 1258 * @return Returns ERR_OK on success, others on failure. 1259 */ 1260 virtual int32_t RequestAssertFaultDialog( 1261 const sptr<IRemoteObject> &callback, const AAFwk::WantParams &wantParams) override; 1262 1263 /** 1264 * @brief Notify the operation status of the user. 1265 * @param assertFaultSessionId Indicates the request ID of AssertFault. 1266 * @param userStatus Operation status of the user. 1267 * @return Returns ERR_OK on success, others on failure. 1268 */ 1269 virtual int32_t NotifyDebugAssertResult(uint64_t assertFaultSessionId, AAFwk::UserStatus userStatus) override; 1270 1271 /** 1272 * Starts a new ability with specific start options. 1273 * 1274 * @param want, the want of the ability to start. 1275 * @param startOptions Indicates the options used to start. 1276 * @return Returns ERR_OK on success, others on failure. 1277 */ 1278 virtual int32_t StartShortcut(const Want &want, const StartOptions &startOptions) override; 1279 1280 /** 1281 * Get ability state by persistent id. 1282 * 1283 * @param persistentId, the persistentId of the session. 1284 * @param state Indicates the ability state. 1285 * @return Returns ERR_OK on success, others on failure. 1286 */ 1287 virtual int32_t GetAbilityStateByPersistentId(int32_t persistentId, bool &state) override; 1288 1289 /** 1290 * Transfer resultCode & want to ability manager service. 1291 * 1292 * @param callerToken caller ability token. 1293 * @param requestCode the resultCode of the ability to start. 1294 * @param want Indicates the ability to start. 1295 * @return Returns ERR_OK on success, others on failure. 1296 */ 1297 virtual int32_t TransferAbilityResultForExtension(const sptr<IRemoteObject> &callerToken, int32_t resultCode, 1298 const Want &want) override; 1299 1300 /** 1301 * Notify ability manager service frozen process. 1302 * 1303 * @param pidList, the pid list of the frozen process. 1304 * @param uid, the uid of the frozen process. 1305 */ 1306 virtual void NotifyFrozenProcessByRSS(const std::vector<int32_t> &pidList, int32_t uid) override; 1307 1308 /** 1309 * Open atomic service window prior to finishing free install. 1310 * 1311 * @param bundleName, the bundle name of the atomic service. 1312 * @param moduleName, the module name of the atomic service. 1313 * @param abilityName, the ability name of the atomic service. 1314 * @param startTime, the starting time of the free install task. 1315 * @return Returns ERR_OK on success, others on failure. 1316 */ 1317 virtual int32_t PreStartMission(const std::string& bundleName, const std::string& moduleName, 1318 const std::string& abilityName, const std::string& startTime) override; 1319 1320 /** 1321 * Request to clean UIAbility from user. 1322 * 1323 * @param sessionInfo the session info of the ability to clean. 1324 * @return Returns ERR_OK on success, others on failure. 1325 */ 1326 virtual int32_t CleanUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo) override; 1327 1328 /** 1329 * Open link of ability and atomic service. 1330 * 1331 * @param want Ability want. 1332 * @param callerToken Caller ability token. 1333 * @param userId User ID. 1334 * @param requestCode Ability request code. 1335 * @return Returns ERR_OK on success, others on failure. 1336 */ 1337 virtual int32_t OpenLink(const Want& want, sptr<IRemoteObject> callerToken, 1338 int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE) override; 1339 1340 /** 1341 * Terminate the mission. 1342 * 1343 * @param missionId, The mission id of the UIAbility need to be terminated. 1344 * @return Returns ERR_OK on success, others on failure. 1345 */ 1346 virtual int32_t TerminateMission(int32_t missionId) override; 1347 1348 /** 1349 * update associate config list by rss. 1350 * 1351 * @param configs The rss config info. 1352 * @param exportConfigs The rss export config info. 1353 * @param flag UPDATE_CONFIG_FLAG_COVER is cover config, UPDATE_CONFIG_FLAG_APPEND is append config. 1354 */ 1355 virtual int32_t UpdateAssociateConfigList(const std::map<std::string, std::list<std::string>>& configs, 1356 const std::list<std::string>& exportConfigs, int32_t flag) override; 1357 1358 private: 1359 template <typename T> 1360 int GetParcelableInfos(MessageParcel &reply, std::vector<T> &parcelableInfos); 1361 bool WriteInterfaceToken(MessageParcel &data); 1362 // flag = true : terminate; flag = false : close 1363 int TerminateAbility(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant, bool flag); 1364 ErrCode SendRequest(AbilityManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply, 1365 MessageOption& option); 1366 int CheckUISessionParams(MessageParcel &data, const sptr<IRemoteObject> &callerToken, 1367 const sptr<SessionInfo> &sessionInfo, int32_t userId, int requestCode); 1368 bool UpdateAssociateConfigInner(const std::map<std::string, std::list<std::string>>& configs, 1369 MessageParcel& data); 1370 1371 private: 1372 static inline BrokerDelegator<AbilityManagerProxy> delegator_; 1373 }; 1374 } // namespace AAFwk 1375 } // namespace OHOS 1376 #endif 1377