From e3b9121aa84d060bdf3b1eb27c652f5315514fe8 Mon Sep 17 00:00:00 2001 From: 18795846185 Date: Sat, 28 Jun 2025 18:59:31 +0800 Subject: [PATCH] idl appmgr Signed-off-by: 18795846185 --- .../test/mock/aafwk/mock_app_mgr_service.h | 324 +++++++++++++++--- 1 file changed, 284 insertions(+), 40 deletions(-) diff --git a/services/test/mock/aafwk/mock_app_mgr_service.h b/services/test/mock/aafwk/mock_app_mgr_service.h index 177ea0e15..01a3f49a9 100644 --- a/services/test/mock/aafwk/mock_app_mgr_service.h +++ b/services/test/mock/aafwk/mock_app_mgr_service.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,58 +31,66 @@ public: const std::shared_ptr &want)); MOCK_METHOD2(TerminateAbility, void(const sptr &token, bool clearMissionFlag)); MOCK_METHOD2(UpdateAbilityState, void(const sptr &token, const AbilityState state)); - MOCK_METHOD1(AttachApplication, void(const sptr &app)); - MOCK_METHOD1(NotifyMemoryLevel, int(int32_t level)); - MOCK_METHOD1(ApplicationForegrounded, void(const int32_t recordId)); - MOCK_METHOD1(ApplicationBackgrounded, void(const int32_t recordId)); - MOCK_METHOD1(ApplicationTerminated, void(const int32_t recordId)); + MOCK_METHOD1(AttachApplication, ErrCode(const sptr &app)); + MOCK_METHOD2(NotifyMemoryLevel, ErrCode(int32_t level, int32_t& funcResult)); + MOCK_METHOD1(ApplicationForegrounded, ErrCode(int32_t recordId)); + MOCK_METHOD1(ApplicationBackgrounded, ErrCode(int32_t recordId)); + MOCK_METHOD1(ApplicationTerminated, ErrCode(int32_t recordId)); MOCK_METHOD2(CheckPermission, int32_t(const int32_t recordId, const std::string &permission)); - MOCK_METHOD1(AbilityCleaned, void(const sptr &token)); + MOCK_METHOD1(AbilityCleaned, ErrCode(const sptr &token)); MOCK_METHOD1(KillApplication, int32_t(const std::string &appName)); MOCK_METHOD2(KillApplicationByUid, int(const std::string &, const int uid)); MOCK_METHOD1(IsBackgroundRunningRestricted, int(const std::string &bundleName)); - MOCK_METHOD1(GetAllRunningProcesses, int(std::vector &info)); - MOCK_METHOD2(GetProcessRunningInfosByUserId, int(std::vector &info, int32_t userId)); - MOCK_METHOD0(GetAmsMgr, sptr()); + MOCK_METHOD2(GetAllRunningProcesses, ErrCode(std::vector &info, int32_t& funcResult)); + MOCK_METHOD3(GetProcessRunningInfosByUserId, + ErrCode(std::vector &info, int32_t userId, int32_t& funcResult)); + MOCK_METHOD1(GetAmsMgr, ErrCode(sptr&)); MOCK_METHOD1(GetAppFreezingTime, void(int &time)); MOCK_METHOD1(SetAppFreezingTime, void(int time)); - MOCK_METHOD3(ClearUpApplicationData, int32_t(const std::string&, int32_t appCloneIndex, int32_t userId)); - MOCK_METHOD1(StartupResidentProcess, void(const std::vector &bundleInfos)); - MOCK_METHOD1(AddAbilityStageDone, void(const int32_t recordId)); - MOCK_METHOD0(PreStartNWebSpawnProcess, int()); - MOCK_METHOD4(StartRenderProcess, int(const std::string&, int32_t, int32_t, pid_t&)); - MOCK_METHOD1(AttachRenderProcess, void(const sptr &renderScheduler)); - MOCK_METHOD2(GetRenderProcessTerminationStatus, int(pid_t renderPid, int &status)); + MOCK_METHOD3(ClearUpApplicationData, + (const std::string&, int32_t appCloneIndex, int32_t userId, int32_t& funcResult)); + MOCK_METHOD1(StartupResidentProcess, ErrCode(const std::vector &bundleInfos)); + MOCK_METHOD1(AddAbilityStageDone, ErrCode(const int32_t recordId)); + MOCK_METHOD1(PreStartNWebSpawnProcess, ErrCode(int32_t& funcResult)); + MOCK_METHOD7(StartRenderProcess, + ErrCode(const std::string&, int32_t, int32_t, int32_t, pid_t&, bool, int32_t& funcResult)); + MOCK_METHOD1(AttachRenderProcess, ErrCode(const sptr &renderScheduler)); + MOCK_METHOD3(GetRenderProcessTerminationStatus, ErrCode(pid_t renderPid, int &status, int32_t& funcResult)); MOCK_METHOD3(ScheduleAcceptWantDone, - void(const int32_t recordId, const AAFwk::Want &want, const std::string &flag)); - MOCK_METHOD2(GetAbilityRecordsByProcessID, int(const int pid, std::vector> &tokens)); - MOCK_METHOD1(GetConfiguration, int32_t(Configuration& config)); - MOCK_METHOD1(UpdateConfiguration, int32_t(const Configuration &config)); - MOCK_METHOD1(RegisterConfigurationObserver, int32_t(const sptr &observer)); - MOCK_METHOD1(UnregisterConfigurationObserver, int32_t(const sptr &observer)); + ErrCode(const int32_t recordId, const AAFwk::Want &want, const std::string &flag)); + MOCK_METHOD2(GetAbilityRecordsByProcessID, + ErrCode(const int pid, std::vector> &tokens, int32_t& funcResult)); + MOCK_METHOD2(GetConfiguration, ErrCode(Configuration& config, int32_t& funcResult)); + MOCK_METHOD2(UpdateConfiguration, ErrCode(const Configuration &config, int32_t& funcResult)); + MOCK_METHOD2(RegisterConfigurationObserver, + ErrCode(const sptr &observer, int32_t& funcResult)); + MOCK_METHOD2(UnregisterConfigurationObserver, + ErrCode(const sptr &observer, int32_t& funcResult)); #ifdef ABILITY_COMMAND_FOR_TEST MOCK_METHOD0(BlockAppService, int()); #endif - MOCK_METHOD1(GetAppRunningStateByBundleName, bool(const std::string &bundleName)); - MOCK_METHOD2(NotifyLoadRepairPatch, int32_t(const std::string &bundleName, - const sptr &callback)); - MOCK_METHOD2(NotifyHotReloadPage, int32_t(const std::string &bundleName, const sptr &callback)); - MOCK_METHOD2(NotifyUnLoadRepairPatch, int32_t(const std::string &bundleName, - const sptr &callback)); + MOCK_METHOD2(GetAppRunningStateByBundleName, ErrCode(const std::string &bundleName, bool& funcResult)); + MOCK_METHOD3(NotifyLoadRepairPatch, ErrCode(const std::string &bundleName, + const sptr &callback, int32_t& funcResult)); + MOCK_METHOD3(NotifyHotReloadPage, + ErrCode(const std::string &bundleName, const sptr &callback, int32_t& funcResult)); + MOCK_METHOD3(NotifyUnLoadRepairPatch, ErrCode(const std::string &bundleName, + const sptr &callback, int32_t& funcResult)); int32_t GetForegroundApplications(std::vector &list) override; - int32_t RegisterApplicationStateObserver(const sptr &observer, - const std::vector &bundleNameList); - int32_t UnregisterApplicationStateObserver(const sptr &observer); - - void SwitchForeOrBackGround(uint32_t tokenId, int32_t flag); - - virtual int StartUserTestProcess( - const AAFwk::Want &want, const sptr &observer, const BundleInfo &bundleInfo, int32_t userId) + ErrCode RegisterApplicationStateObserver(const sptr &observer, + const std::vector &bundleNameList, int32_t& funcResult) override { - return 0; + return ERR_OK; + } + ErrCode UnregisterApplicationStateObserver( + const sptr &observer, int32_t& funcResult) override + { + return ERR_OK; } + void SwitchForeOrBackGround(uint32_t tokenId, int32_t flag); - virtual int FinishUserTest(const std::string &msg, const int64_t &resultCode, const std::string &bundleName) + virtual ErrCode StartUserTestProcess(const AAFwk::Want &want, const sptr &observer, + const BundleInfo &bundleInfo, int32_t userId, int32_t& funcResult) { return 0; } @@ -148,6 +156,242 @@ public: } int code_; + int32_t GetRunningMultiAppInfoByBundleName(const std::string &bundleName, + RunningMultiAppInfo &info) + { + return 0; + } + + ErrCode PreloadApplication( + const std::string& bundleName, int32_t userId, PreloadMode preloadMode, int32_t appIndex) + { + return 0; + } + + ErrCode IsTerminatingByPid(int32_t pid, bool& isTerminating) + { + return 0; + } + + ErrCode HasDumpPermission(bool& funcResult) + { + return 0; + } + + ErrCode DumpJsHeapMemory(const JsHeapDumpInfo& info) + { + return 0; + } + + ErrCode DumpCjHeapMemory(const CjHeapDumpInfo& info) + { + return 0; + } + + ErrCode GetForegroundApplications( + std::vector& list) + { + return 0; + } + + ErrCode FinishUserTest( + const std::string& msg, + int64_t resultCode, + const std::string& bundleName) + { + return 0; + } + + ErrCode SetAppFreezeFilter( + int32_t pid, + bool& funcResult) + { + funcResult = false; + return 0; + } + + ErrCode SetContinuousTaskProcess( + int32_t pid, + bool isContinuousTask) + { + return 0; + } + + ErrCode GetRunningProcessInfoByPid( + int32_t pid, + RunningProcessInfo& info) + { + return 0; + } + + ErrCode GetRunningProcessInfoByChildProcessPid( + int32_t childPid, + RunningProcessInfo& info) + { + return 0; + } + + ErrCode NotifyPageShow( + const sptr& token, + const PageStateData& pageStateData) + { + return 0; + } + + ErrCode NotifyPageHide( + const sptr& token, + const PageStateData& pageStateData) + { + return 0; + } + + ErrCode IsFinalAppProcess( + bool& funcResult) + { + return 0; + } + + ErrCode SignRestartAppFlag( + int32_t uid, + const std::string& instanceKey) + { + return 0; + } + + ErrCode GetAppRunningUniqueIdByPid( + int32_t pid, + std::string& appRunningUniqueId) + { + return 0; + } + + ErrCode GetAllUIExtensionRootHostPid( + int32_t pid, + std::vector& hostPids) + { + return 0; + } + + ErrCode GetAllUIExtensionProviderPid( + int32_t hostPid, + std::vector& providerPids) + { + return 0; + } + + ErrCode NotifyMemorySizeStateChanged( + int32_t memorySizeState) + { + return 0; + } + + ErrCode SaveBrowserChannel( + const sptr& browser) + { + return 0; + } + + ErrCode CheckCallingIsUserTestMode( + int32_t pid, + bool& isUserTest) + { + return 0; + } + + ErrCode SetAppAssertionPauseState( + bool flag) + { + return 0; + } + + ErrCode NotifyProcessDependedOnWeb() + { + return 0; + } + + ErrCode KillProcessDependedOnWeb() + { + return 0; + } + + ErrCode RestartResidentProcessDependedOnWeb() + { + return 0; + } + + ErrCode KillAppSelfWithInstanceKey( + const std::string& instanceKey, + bool clearPageStack, + const std::string& reason) + { + return 0; + } + + ErrCode UpdateInstanceKeyBySpecifiedId( + int32_t specifiedId, + const std::string& instanceKey) + { + return 0; + } + + ErrCode IsSpecifiedModuleLoaded( + const Want& want, + const AbilityInfo& abilityInfo, + bool& funcResult) + { + return 0; + } + + ErrCode UpdateProcessMemoryState( + const std::vector& procMemState) + { + return 0; + } + + ErrCode GetKilledProcessInfo( + int32_t pid, + int32_t uid, + KilledProcessInfo& info) + { + return 0; + } + + ErrCode LaunchAbility( + const sptr& token) + { + return 0; + } + + ErrCode UpdateConfigurationForBackgroundApp( + const std::vector& appInfos, + const ConfigurationPolicy& policy, + int32_t userId) + { + return 0; + } + + ErrCode RegisterNativeChildExitNotify( + const sptr& notify) + { + return 0; + } + + ErrCode UnregisterNativeChildExitNotify( + const sptr& notify) + { + return 0; + } + + ErrCode PromoteCurrentToCandidateMasterProcess( + bool isInsertToHead) + { + return 0; + } + + ErrCode DemoteCurrentFromCandidateMasterProcess() + { + return 0; + } private: Semaphore sem_; @@ -157,4 +401,4 @@ private: }; } } -#endif // MOCK_APP_MGR_SERVICE_H \ No newline at end of file +#endif // MOCK_APP_MGR_SERVICE_H -- Gitee