1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_FORM_FWK_MOCK_ABILITY_MANAGER_H 17 #define OHOS_FORM_FWK_MOCK_ABILITY_MANAGER_H 18 19 #include <iremote_object.h> 20 #include <iremote_stub.h> 21 #include <iremote_proxy.h> 22 23 #include "ability_manager_interface.h" 24 #include "mock_form_provider_client.h" 25 #include "semaphore_ex.h" 26 27 namespace OHOS { 28 namespace AppExecFwk { 29 class MockAbilityMgrProxy : public IRemoteProxy<AAFwk::IAbilityManager> { 30 public: MockAbilityMgrProxy(const sptr<IRemoteObject> &impl)31 explicit MockAbilityMgrProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<AAFwk::IAbilityManager>(impl) 32 {} 33 34 virtual~MockAbilityMgrProxy() = default; 35 int StartAbility( 36 const AAFwk::Want &want, int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = -1) override 37 { 38 return 0; 39 } 40 int StartAbility(const AAFwk::Want &want, const sptr<IRemoteObject> &callerToken, 41 int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = -1) override 42 { 43 return 0; 44 } 45 int StartAbility( 46 const Want &want, 47 const StartOptions &startOptions, 48 const sptr<IRemoteObject> &callerToken, 49 int32_t userId = DEFAULT_INVAL_VALUE, 50 int requestCode = DEFAULT_INVAL_VALUE) override 51 { 52 return 0; 53 } 54 int TerminateAbility( 55 const sptr<IRemoteObject> &token, int resultCode, const AAFwk::Want *resultWant = nullptr) override 56 { 57 return 0; 58 } 59 int ConnectAbility(const AAFwk::Want &want, const sptr<AAFwk::IAbilityConnection> &connect, 60 const sptr<IRemoteObject> &callerToken, int32_t userId = DEFAULT_INVAL_VALUE) override 61 { 62 return 0; 63 } 64 int DisconnectAbility(sptr<AAFwk::IAbilityConnection> connect) override 65 { 66 return 0; 67 } 68 sptr<AAFwk::IAbilityScheduler> AcquireDataAbility( 69 const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken) override 70 { 71 return nullptr; 72 } 73 int ReleaseDataAbility( 74 sptr<AAFwk::IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) override 75 { 76 return 0; 77 } 78 79 int AttachAbilityThread( 80 const sptr<AAFwk::IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) override 81 { 82 return 0; 83 } 84 int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) override 85 { 86 return 0; 87 } 88 89 sptr<AAFwk::IWantSender> GetWantSender( 90 const AAFwk::WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid) override 91 { 92 return nullptr; 93 } 94 int SendWantSender(sptr<AAFwk::IWantSender> target, const AAFwk::SenderInfo &senderInfo) override 95 { 96 return 0; 97 } 98 void CancelWantSender(const sptr<AAFwk::IWantSender> &sender) override 99 { 100 return; 101 } 102 int GetPendingWantUid(const sptr<AAFwk::IWantSender> &target) override 103 { 104 return 0; 105 } 106 int GetPendingWantUserId(const sptr<AAFwk::IWantSender> &target) override 107 { 108 return 0; 109 } 110 std::string GetPendingWantBundleName(const sptr<AAFwk::IWantSender> &target) override 111 { 112 return ""; 113 } 114 int GetPendingWantCode(const sptr<AAFwk::IWantSender> &target) override 115 { 116 return 0; 117 } 118 int GetPendingWantType(const sptr<AAFwk::IWantSender> &target) override 119 { 120 return 0; 121 } 122 void RegisterCancelListener( 123 const sptr<AAFwk::IWantSender> &sender, const sptr<AAFwk::IWantReceiver> &receiver) override 124 { 125 return; 126 } 127 int32_t ReportDrawnCompleted(const sptr<IRemoteObject>& callerToken) override 128 { 129 return 0; 130 } 131 void UnregisterCancelListener( 132 const sptr<AAFwk::IWantSender> &sender, const sptr<AAFwk::IWantReceiver> &receiver) override 133 { 134 return; 135 } 136 int GetPendingRequestWant(const sptr<AAFwk::IWantSender> &target, std::shared_ptr<Want> &want) override 137 { 138 return 0; 139 } ScheduleConnectAbilityDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject)140 int ScheduleConnectAbilityDone(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) 141 { 142 return 0; 143 } 144 int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) override 145 { 146 return 0; 147 } 148 int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) override 149 { 150 return 0; 151 } 152 int ScheduleCommandAbilityWindowDone( 153 const sptr<IRemoteObject> &token, 154 const sptr<AAFwk::SessionInfo> &sessionInfo, 155 AAFwk::WindowCommand winCmd, 156 AAFwk::AbilityCommand abilityCmd) override 157 { 158 return 0; 159 } 160 void DumpState(const std::string &args, std::vector<std::string> &state) override 161 { 162 return; 163 } 164 int StopServiceAbility(const AAFwk::Want &want, int32_t userId = DEFAULT_INVAL_VALUE, 165 const sptr<IRemoteObject> &token = nullptr) override 166 { 167 return 0; 168 } 169 170 int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) override 171 { 172 return 0; 173 } 174 175 void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) override 176 { 177 return; 178 } 179 180 int KillProcess(const std::string &bundleName, const bool clreaPageStack = true) override 181 { 182 return 0; 183 } 184 int UninstallApp(const std::string &bundleName, int32_t uid) override 185 { 186 return 0; 187 } TerminateAbilityByRecordId(const int64_t recordId = -1)188 int TerminateAbilityByRecordId(const int64_t recordId = -1) 189 { 190 return 0; 191 } 192 193 int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) override 194 { 195 return 0; 196 } 197 int NotifyContinuationResult(int32_t missionId, int32_t result) override 198 { 199 return 0; 200 } 201 int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId, 202 int32_t missionId, const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) override 203 { 204 return 0; 205 } 206 int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) override 207 { 208 return 0; 209 } 210 void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) override 211 {} 212 213 int LockMissionForCleanup(int32_t missionId) override 214 { 215 return 0; 216 } 217 218 int UnlockMissionForCleanup(int32_t missionId) override 219 { 220 return 0; 221 } 222 223 int RegisterMissionListener(const sptr<IMissionListener> &listener) override 224 { 225 return 0; 226 } 227 228 int UnRegisterMissionListener(const sptr<IMissionListener> &listener) override 229 { 230 return 0; 231 } 232 233 int GetMissionInfos(const std::string& deviceId, int32_t numMax, 234 std::vector<MissionInfo> &missionInfos) override 235 { 236 return 0; 237 } 238 239 int GetMissionInfo(const std::string& deviceId, int32_t missionId, 240 MissionInfo &missionInfo) override 241 { 242 return 0; 243 } 244 245 int CleanMission(int32_t missionId) override 246 { 247 return 0; 248 } 249 250 int CleanAllMissions() override 251 { 252 return 0; 253 } 254 int MoveMissionToFront(int32_t missionId) override 255 { 256 return 0; 257 } 258 int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) override 259 { 260 return 0; 261 } 262 #ifdef SUPPORT_GRAPHICS 263 int SetMissionLabel(const sptr<IRemoteObject> &token, 264 const std::string &lable) override 265 { 266 return 0; 267 } 268 269 int SetMissionIcon(const sptr<IRemoteObject> &token, 270 const std::shared_ptr<OHOS::Media::PixelMap> &icon) override 271 { 272 return 0; 273 } 274 275 void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) override {} 276 #endif 277 int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) override 278 { 279 return 0; 280 } 281 282 int FinishUserTest( 283 const std::string &msg, const int64_t &resultCode, const std::string &bundleName) override 284 { 285 return 0; 286 } 287 288 int GetTopAbility(sptr<IRemoteObject> &token) override 289 { 290 return 0; 291 } 292 293 int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) override 294 { 295 return 0; 296 } 297 298 int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) override 299 { 300 return 0; 301 } 302 303 int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) override 304 { 305 return 0; 306 } 307 308 int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) override 309 { 310 return 0; 311 } IsValidMissionIds(const std::vector<int32_t>& missionIds, std::vector<MissionValidResult>& results)312 int32_t IsValidMissionIds(const std::vector<int32_t>& missionIds, std::vector<MissionValidResult>& results) 313 { 314 return 0; 315 } 316 ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken, const InsightIntentExecuteParam ¶m)317 int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken, 318 const InsightIntentExecuteParam ¶m) 319 { 320 return 0; 321 } 322 ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId, const InsightIntentExecuteResult &result)323 int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId, 324 const InsightIntentExecuteResult &result) 325 { 326 return 0; 327 } 328 329 int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) override 330 { 331 return 0; 332 } 333 }; 334 335 class MockAbilityMgrStub : public IRemoteStub<AAFwk::IAbilityManager> { 336 public: 337 using Uri = OHOS::Uri; 338 MockAbilityMgrStub() = default; 339 virtual ~MockAbilityMgrStub() = default; 340 341 int OnRemoteRequest( 342 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override 343 { 344 return 0; 345 } 346 347 int32_t SetApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) override 348 { 349 return 0; 350 } 351 352 int32_t CancelApplicationAutoStartupByEDM(const AutoStartupInfo &info, bool flag) override 353 { 354 return 0; 355 } 356 }; 357 class MockAbilityMgrService : public MockAbilityMgrStub { 358 public: Wait()359 void Wait() 360 { 361 sem_.Wait(); 362 } 363 Post()364 int Post() 365 { 366 sem_.Post(); 367 return 0; 368 } 369 PostVoid()370 void PostVoid() 371 { 372 sem_.Post(); 373 } 374 375 int StartAbility( 376 const AAFwk::Want &want, int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = -1) override 377 { 378 return startAbility_; 379 } 380 int StartAbility(const AAFwk::Want &want, const sptr<IRemoteObject> &callerToken, 381 int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = -1) override 382 { 383 return startAbility_; 384 } 385 386 int32_t StartAbilityByInsightIntent(const Want &want, const sptr<IRemoteObject> &callerToken, 387 uint64_t intentId, int32_t userId) override 388 { 389 return 0; 390 } 391 392 int StartAbility( 393 const Want &want, 394 const StartOptions &startOptions, 395 const sptr<IRemoteObject> &callerToken, 396 int32_t userId = DEFAULT_INVAL_VALUE, 397 int requestCode = DEFAULT_INVAL_VALUE) override 398 { 399 return startAbility_; 400 } 401 int TerminateAbility( 402 const sptr<IRemoteObject> &token, int resultCode, const AAFwk::Want *resultWant = nullptr) override 403 { 404 return 0; 405 } 406 int CloseAbility(const sptr<IRemoteObject> &token, int resultCode = DEFAULT_INVAL_VALUE, 407 const Want *resultWant = nullptr) override 408 { 409 return 0; 410 } 411 int MinimizeAbility(const sptr<IRemoteObject> &token, bool fromUser) override 412 { 413 return 0; 414 } 415 int ConnectAbility(const AAFwk::Want &want, const sptr<AAFwk::IAbilityConnection> &connect, 416 const sptr<IRemoteObject> &callerToken, int32_t userId = DEFAULT_INVAL_VALUE) override 417 { 418 connect->OnAbilityConnectDone(want.GetElement(), new (std::nothrow) MockFormProviderClient(), 0); 419 return 0; 420 } 421 int DisconnectAbility(sptr<AAFwk::IAbilityConnection> connect) override 422 { 423 return 0; 424 } 425 sptr<AAFwk::IAbilityScheduler> AcquireDataAbility( 426 const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken) override 427 { 428 return nullptr; 429 } 430 int ReleaseDataAbility( 431 sptr<AAFwk::IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken) override 432 { 433 return 0; 434 } 435 int AttachAbilityThread( 436 const sptr<AAFwk::IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token) override 437 { 438 return 0; 439 } 440 int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData) override 441 { 442 return 0; 443 } 444 int ScheduleConnectAbilityDone( 445 const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject) override 446 { 447 return 0; 448 } 449 int ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token) override 450 { 451 return 0; 452 } 453 int ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token) override 454 { 455 return 0; 456 } 457 int ScheduleCommandAbilityWindowDone( 458 const sptr<IRemoteObject> &token, 459 const sptr<AAFwk::SessionInfo> &sessionInfo, 460 AAFwk::WindowCommand winCmd, 461 AAFwk::AbilityCommand abilityCmd) override 462 { 463 return 0; 464 } 465 void DumpState(const std::string &args, std::vector<std::string> &state) override 466 { 467 return; 468 } 469 470 void DumpSysState( 471 const std::string& args, std::vector<std::string>& state, bool isClient, bool isUserID, int UserID) override 472 { 473 return; 474 } 475 476 int StopServiceAbility(const AAFwk::Want &want, int32_t userId = DEFAULT_INVAL_VALUE, 477 const sptr<IRemoteObject> &token = nullptr) override 478 { 479 return 0; 480 } 481 482 sptr<AAFwk::IWantSender> GetWantSender( 483 const AAFwk::WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken, int32_t uid) override 484 { 485 return nullptr; 486 } 487 int SendWantSender(sptr<AAFwk::IWantSender> target, const AAFwk::SenderInfo &senderInfo) override 488 { 489 return 0; 490 } 491 void CancelWantSender(const sptr<AAFwk::IWantSender> &sender) override 492 { 493 return; 494 } 495 int GetPendingWantUid(const sptr<AAFwk::IWantSender> &target) override 496 { 497 return 0; 498 } 499 int GetPendingWantUserId(const sptr<AAFwk::IWantSender> &target) override 500 { 501 return 0; 502 } 503 std::string GetPendingWantBundleName(const sptr<AAFwk::IWantSender> &target) override 504 { 505 return ""; 506 } 507 int GetPendingWantCode(const sptr<AAFwk::IWantSender> &target) override 508 { 509 return 0; 510 } 511 int GetPendingWantType(const sptr<AAFwk::IWantSender> &target) override 512 { 513 return 0; 514 } 515 int32_t ReportDrawnCompleted(const sptr<IRemoteObject>& callerToken) override 516 { 517 return 0; 518 } 519 void RegisterCancelListener( 520 const sptr<AAFwk::IWantSender> &sender, const sptr<AAFwk::IWantReceiver> &receiver) override 521 { 522 return; 523 } 524 void UnregisterCancelListener( 525 const sptr<AAFwk::IWantSender> &sender, const sptr<AAFwk::IWantReceiver> &receiver) override 526 { 527 return; 528 } 529 int GetPendingRequestWant(const sptr<AAFwk::IWantSender> &target, std::shared_ptr<Want> &want) override 530 { 531 return 0; 532 } 533 534 int32_t GetMissionIdByToken(const sptr<IRemoteObject> &token) override 535 { 536 return 0; 537 } 538 539 void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) override 540 { 541 return; 542 } 543 544 int KillProcess(const std::string &bundleName, const bool clreaPageStack = true) override 545 { 546 return 0; 547 } 548 int UninstallApp(const std::string &bundleName, int32_t uid) override 549 { 550 return 0; 551 } TerminateAbilityByRecordId(const int64_t recordId = -1)552 int TerminateAbilityByRecordId(const int64_t recordId = -1) 553 { 554 return 0; 555 } 556 557 int StartAbility( 558 const Want &want, 559 const AbilityStartSetting &abilityStartSetting, 560 const sptr<IRemoteObject> &callerToken, 561 int32_t userId = DEFAULT_INVAL_VALUE, 562 int requestCode = DEFAULT_INVAL_VALUE) override 563 { 564 return startAbility_; 565 } 566 567 int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) override 568 { 569 return 0; 570 } 571 int LockMissionForCleanup(int32_t missionId) override 572 { 573 return 0; 574 } 575 int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status) override 576 { 577 return 0; 578 } 579 int NotifyContinuationResult(int32_t missionId, int32_t result) override 580 { 581 return 0; 582 } 583 int ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId, 584 int32_t missionId, const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams) override 585 { 586 return 0; 587 } 588 int ContinueAbility(const std::string &deviceId, int32_t missionId, uint32_t versionCode) override 589 { 590 return 0; 591 } 592 void NotifyCompleteContinuation(const std::string &deviceId, int32_t sessionId, bool isSuccess) override 593 {} 594 595 int UnlockMissionForCleanup(int32_t missionId) override 596 { 597 return 0; 598 } 599 600 int RegisterMissionListener(const sptr<IMissionListener> &listener) override 601 { 602 return 0; 603 } 604 605 int UnRegisterMissionListener(const sptr<IMissionListener> &listener) override 606 { 607 return 0; 608 } 609 610 int GetMissionInfos(const std::string& deviceId, int32_t numMax, 611 std::vector<MissionInfo> &missionInfos) override 612 { 613 return 0; 614 } 615 616 int GetMissionInfo(const std::string& deviceId, int32_t missionId, 617 MissionInfo &missionInfo) override 618 { 619 return 0; 620 } 621 622 int CleanMission(int32_t missionId) override 623 { 624 return 0; 625 } 626 627 int CleanAllMissions() override 628 { 629 return 0; 630 } 631 #ifdef SUPPORT_GRAPHICS 632 void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) override {} 633 634 int SetMissionLabel(const sptr<IRemoteObject> &token, 635 const std::string &lable) override 636 { 637 return 0; 638 } 639 640 int SetMissionIcon(const sptr<IRemoteObject> &token, 641 const std::shared_ptr<OHOS::Media::PixelMap> &icon) override 642 { 643 return 0; 644 } 645 #endif 646 int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) override 647 { 648 return 0; 649 } 650 651 int FinishUserTest( 652 const std::string &msg, const int64_t &resultCode, const std::string &bundleName) override 653 { 654 return 0; 655 } 656 657 int GetTopAbility(sptr<IRemoteObject> &token) override 658 { 659 return 0; 660 } 661 662 int DelegatorDoAbilityForeground(const sptr<IRemoteObject> &token) override 663 { 664 return 0; 665 } 666 667 int DelegatorDoAbilityBackground(const sptr<IRemoteObject> &token) override 668 { 669 return 0; 670 } 671 672 int MoveMissionToFront(int32_t missionId) override 673 { 674 return 0; 675 } 676 int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) override 677 { 678 return 0; 679 } 680 int StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override 681 { 682 return 0; 683 } 684 int StopSyncRemoteMissions(const std::string& devId) override 685 { 686 return 0; 687 } 688 int RegisterMissionListener(const std::string &deviceId, 689 const sptr<IRemoteMissionListener> &listener) override 690 { 691 return 0; 692 } 693 int UnRegisterMissionListener(const std::string &deviceId, 694 const sptr<IRemoteMissionListener> &listener) override 695 { 696 return 0; 697 } 698 int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) override 699 { 700 return 0; 701 } 702 int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) override 703 { 704 return 0; 705 } 706 int GetProcessRunningInfos(std::vector<AppExecFwk::RunningProcessInfo> &info) override 707 { 708 return 0; 709 } 710 int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController, 711 bool imAStabilityTest) override 712 { 713 return 0; 714 } 715 bool IsRunningInStabilityTest() override 716 { 717 return true; 718 } 719 int StartUser(int userId, sptr<IUserCallback> callback, bool isAppRecovery) override 720 { 721 return 0; 722 } 723 int StopUser(int userId, const sptr<IUserCallback> &callback) override 724 { 725 return 0; 726 } 727 int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, 728 MissionSnapshot& snapshot, bool isLowResolution) override 729 { 730 return 0; 731 } 732 int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override 733 { 734 return 0; 735 } 736 #ifdef SUPPORT_GRAPHICS 737 int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler, 738 bool animationEnabled = true) override 739 { 740 return 0; 741 } 742 #endif 743 744 int StartAbilityByCall(const Want &want, const sptr<IAbilityConnection> &connect, 745 const sptr<IRemoteObject> &callerToken, int32_t accountId = DEFAULT_INVAL_VALUE) override 746 { 747 return startAbilityByCall_; 748 } 749 int ReleaseCall( 750 const sptr<IAbilityConnection> &connect, const AppExecFwk::ElementName &element) override 751 { 752 return 0; 753 } 754 755 int DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) override 756 { 757 return 0; 758 } 759 760 int DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) override 761 { 762 return 0; 763 } 764 765 #ifdef ABILITY_COMMAND_FOR_TEST 766 int ForceTimeoutForTest(const std::string &abilityName, const std::string &state) override 767 { 768 return 0; 769 } 770 771 int BlockAmsService() override 772 { 773 return 0; 774 } 775 776 int BlockAppService() override 777 { 778 return 0; 779 } 780 781 int BlockAbility(int32_t abilityRecordId) override 782 { 783 return 0; 784 } 785 #endif IsValidMissionIds(const std::vector<int32_t>& missionIds, std::vector<MissionValidResult>& results)786 int32_t IsValidMissionIds(const std::vector<int32_t>& missionIds, std::vector<MissionValidResult>& results) 787 { 788 return 0; 789 } 790 RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener)791 int32_t RegisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) 792 { 793 return 0; 794 } 795 UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener)796 int32_t UnregisterAppDebugListener(sptr<AppExecFwk::IAppDebugListener> listener) 797 { 798 return 0; 799 } 800 AttachAppDebug(const std::string &bundleName)801 int32_t AttachAppDebug(const std::string &bundleName) 802 { 803 return 0; 804 } 805 DetachAppDebug(const std::string &bundleName)806 int32_t DetachAppDebug(const std::string &bundleName) 807 { 808 return 0; 809 } 810 ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken, const InsightIntentExecuteParam ¶m)811 int32_t ExecuteIntent(uint64_t key, const sptr<IRemoteObject> &callerToken, 812 const InsightIntentExecuteParam ¶m) 813 { 814 return 0; 815 } 816 ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId, const InsightIntentExecuteResult &result)817 int32_t ExecuteInsightIntentDone(const sptr<IRemoteObject> &token, uint64_t intentId, 818 const InsightIntentExecuteResult &result) 819 { 820 return 0; 821 } 822 823 int32_t GetForegroundUIAbilities(std::vector<AppExecFwk::AbilityStateData> &list) override 824 { 825 return 0; 826 } 827 StartAbilityWithSpecifyTokenId(const Want& want, const sptr<IRemoteObject>& callerToken, uint32_t specifyTokenId, int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE)828 int StartAbilityWithSpecifyTokenId(const Want& want, 829 const sptr<IRemoteObject>& callerToken, 830 uint32_t specifyTokenId, 831 int32_t userId = DEFAULT_INVAL_VALUE, 832 int requestCode = DEFAULT_INVAL_VALUE) 833 { 834 return startAbilityWithSpecifyTokenId_; 835 } 836 837 int32_t startAbility_ = 0; 838 839 int32_t startAbilityByCall_ = 0; 840 841 int32_t startAbilityWithSpecifyTokenId_ = 0; 842 private: 843 Semaphore sem_; 844 }; 845 } // namespace AppExecFwk 846 } // namespace OHOS 847 #endif // OHOS_FORM_FWK_MOCK_ABILITY_MANAGER_H 848