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