From 38971ba7cf0d380ffd16b14da8a9c2d9ec6ec267 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 11:46:03 +0800 Subject: [PATCH 1/9] add param want Signed-off-by: unknown --- .../app_manager/include/appmgr/ams_mgr_interface.h | 3 ++- .../app_manager/include/appmgr/ams_mgr_proxy.h | 3 ++- .../app_manager/include/appmgr/app_mgr_client.h | 4 +++- .../app_manager/src/appmgr/ams_mgr_proxy.cpp | 7 ++++++- .../app_manager/src/appmgr/ams_mgr_stub.cpp | 9 ++++++++- .../app_manager/src/appmgr/app_mgr_client.cpp | 5 +++-- services/abilitymgr/include/app_scheduler.h | 4 +++- services/abilitymgr/src/ability_record.cpp | 2 +- services/abilitymgr/src/app_scheduler.cpp | 4 ++-- .../test/mock/include/mock_app_mgr_client.h | 2 +- .../appexecfwk_core/include/appmgr/app_mgr_client.h | 2 +- .../appexecfwk_core/src/appmgr/app_mgr_client.cpp | 2 +- .../src/appmgr/mock_app_scheduler.cpp | 3 ++- services/appmgr/include/ability_running_record.h | 12 +++++++++++- services/appmgr/include/ams_mgr_scheduler.h | 3 ++- services/appmgr/include/app_mgr_service_inner.h | 4 +++- services/appmgr/src/ability_running_record.cpp | 9 +++++++-- services/appmgr/src/ams_mgr_scheduler.cpp | 3 ++- services/appmgr/src/app_mgr_service_inner.cpp | 3 ++- 19 files changed, 62 insertions(+), 22 deletions(-) diff --git a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h index a61aefdfe53..be4ccdbebf1 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h +++ b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h @@ -43,7 +43,8 @@ public: * @return */ virtual void LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo) = 0; + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const AAFwk::Want &want) = 0; /** * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. diff --git a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h index 8a58e6ef9f5..29c2470671c 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h +++ b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h @@ -37,7 +37,8 @@ public: * @return */ virtual void LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo) override; + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const AAFwk::Want &want) override; /** * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h index 3ef4eb1799d..87185599845 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h @@ -42,12 +42,14 @@ public: * Load ability. * * @param token, Ability identify. + * @param preToken the caller * @param abilityInfo, Ability information. * @param appInfo, Application information. + * @param want ability want * @return Returns RESULT_OK on success, others on failure. */ virtual AppMgrResultCode LoadAbility(const sptr &token, const sptr &preToken, - const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo); + const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want); /** * Terminate ability. diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp index effa2e7d679..364edd93813 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp @@ -36,7 +36,8 @@ bool AmsMgrProxy::WriteInterfaceToken(MessageParcel &data) } void AmsMgrProxy::LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo) + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const AAFwk::Want &want) { APP_LOGD("start"); if (!abilityInfo || !appInfo) { @@ -54,6 +55,10 @@ void AmsMgrProxy::LoadAbility(const sptr &token, const sptr remote = Remote(); if (remote == nullptr) { APP_LOGE("Remote() is NULL"); diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp index b9ad246fa30..31e49678d2e 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -112,7 +112,14 @@ ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply) return ERR_APPEXECFWK_PARCEL_ERROR; } - LoadAbility(token, preToke, abilityInfo, appInfo); + std::shared_ptr want(data.ReadParcelable()); + if (!want) { + APP_LOGE("ReadParcelable want failed"); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + + + LoadAbility(token, preToke, abilityInfo, appInfo, want); return NO_ERROR; } diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp index a19edea6712..0deb2c868f0 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp @@ -37,7 +37,7 @@ AppMgrClient::~AppMgrClient() {} AppMgrResultCode AppMgrClient::LoadAbility(const sptr &token, const sptr &preToken, - const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo) + const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want) { sptr service = iface_cast(remote_); if (service != nullptr) { @@ -46,7 +46,8 @@ AppMgrResultCode AppMgrClient::LoadAbility(const sptr &token, con // From here, separate AbilityInfo and ApplicationInfo from AA. std::shared_ptr abilityInfoPtr = std::make_shared(abilityInfo); std::shared_ptr appInfoPtr = std::make_shared(appInfo); - amsService->LoadAbility(token, preToken, abilityInfoPtr, appInfoPtr); + std::shared_ptr wantPtr = std::make_shared(want); + amsService->LoadAbility(token, preToken, abilityInfoPtr, appInfoPtr, want); return AppMgrResultCode::RESULT_OK; } } diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index 1a4382adbc0..0576e6c8ac4 100644 --- a/services/abilitymgr/include/app_scheduler.h +++ b/services/abilitymgr/include/app_scheduler.h @@ -115,10 +115,12 @@ public: * @param preToken, the token of ability's caller. * @param abilityinfo, ability info. * @param application, application info. + * @param want ability want * @return true on success ,false on failure. */ int LoadAbility(const sptr &token, const sptr &preToken, - const AppExecFwk::AbilityInfo &abilityinfo, const AppExecFwk::ApplicationInfo &application); + const AppExecFwk::AbilityInfo &abilityinfo, const AppExecFwk::ApplicationInfo &application, + const Want &want); /** * terminate ability with token. diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index 90c73efb5bd..ec5bc27db9a 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -187,7 +187,7 @@ int AbilityRecord::LoadAbility() } } return DelayedSingleton::GetInstance()->LoadAbility( - token_, callerToken_, abilityInfo_, applicationInfo_); + token_, callerToken_, abilityInfo_, applicationInfo_, want_); } void AbilityRecord::ForegroundAbility() diff --git a/services/abilitymgr/src/app_scheduler.cpp b/services/abilitymgr/src/app_scheduler.cpp index e047ef049f2..bbdf03f348a 100644 --- a/services/abilitymgr/src/app_scheduler.cpp +++ b/services/abilitymgr/src/app_scheduler.cpp @@ -74,13 +74,13 @@ bool AppScheduler::Init(const std::weak_ptr &callback) } int AppScheduler::LoadAbility(const sptr &token, const sptr &preToken, - const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo) + const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want) { HILOG_DEBUG("Load ability."); CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR); /* because the errcode type of AppMgr Client API will be changed to int, * so must to covert the return result */ - int ret = static_cast(appMgrClient_->LoadAbility(token, preToken, abilityInfo, applicationInfo)); + int ret = static_cast(appMgrClient_->LoadAbility(token, preToken, abilityInfo, applicationInfo, want)); if (ret != ERR_OK) { HILOG_ERROR("AppScheduler fail to LoadAbility. ret %d", ret); return INNER_ERR; diff --git a/services/abilitymgr/test/mock/include/mock_app_mgr_client.h b/services/abilitymgr/test/mock/include/mock_app_mgr_client.h index 102804069df..74457168805 100644 --- a/services/abilitymgr/test/mock/include/mock_app_mgr_client.h +++ b/services/abilitymgr/test/mock/include/mock_app_mgr_client.h @@ -29,7 +29,7 @@ public: virtual ~MockAppMgrClient() {}; virtual AppMgrResultCode LoadAbility(const sptr &token, const sptr &preToken, - const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo) + const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want) { HILOG_INFO("MockAppMgrClient LoadAbility enter."); token_ = token; diff --git a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/appmgr/app_mgr_client.h b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/appmgr/app_mgr_client.h index 607c1fbf4d2..75d514900ae 100644 --- a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/appmgr/app_mgr_client.h +++ b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/appmgr/app_mgr_client.h @@ -42,7 +42,7 @@ public: * @return Returns RESULT_OK on success, others on failure. */ virtual AppMgrResultCode LoadAbility(const sptr &token, const sptr &preToken, - const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo); + const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want); /** * Terminate ability. diff --git a/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_mgr_client.cpp b/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_mgr_client.cpp index c5ad1856b28..30123d93377 100644 --- a/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_mgr_client.cpp +++ b/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_mgr_client.cpp @@ -35,7 +35,7 @@ AppMgrClient::~AppMgrClient() {} AppMgrResultCode AppMgrClient::LoadAbility(const sptr &token, const sptr &preToken, - const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo) + const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const Want &want) { return AppMgrResultCode::RESULT_OK; } diff --git a/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp b/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp index 033011f7eb4..45bb32bf958 100644 --- a/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp +++ b/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp @@ -43,7 +43,8 @@ bool AppScheduler::Init(const std::weak_ptr &callback) } int AppScheduler::LoadAbility(const sptr &token, const sptr &preToken, - const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo) + const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo, + const Want &want) { HILOG_INFO("Test AppScheduler::LoadAbility()"); if (applicationInfo.bundleName.find("com.ix.First.Test") != std::string::npos) { diff --git a/services/appmgr/include/ability_running_record.h b/services/appmgr/include/ability_running_record.h index eee811ed0a0..f415966d4fc 100644 --- a/services/appmgr/include/ability_running_record.h +++ b/services/appmgr/include/ability_running_record.h @@ -23,12 +23,14 @@ #include "ability_info.h" #include "application_info.h" #include "app_mgr_constants.h" +#include "want.h" namespace OHOS { namespace AppExecFwk { class AbilityRunningRecord { public: - AbilityRunningRecord(const std::shared_ptr &info, const sptr &token); + AbilityRunningRecord(const std::shared_ptr &info, const sptr &token, + const std::shared_ptr &want); virtual ~AbilityRunningRecord(); /** @@ -45,6 +47,13 @@ public: */ const std::shared_ptr &GetAbilityInfo() const; + /** + * @brief Obtains the info of the ability. + * + * @return Returns the ability want. + */ + const std::shared_ptr &GetWant() const; + /** * @brief Obtains the token of the ability. * @@ -169,6 +178,7 @@ private: bool isTerminating_ = false; AbilityState state_ = AbilityState::ABILITY_STATE_BEGIN; std::shared_ptr info_; + std::shared_ptr want_; sptr token_; sptr preToken_; }; diff --git a/services/appmgr/include/ams_mgr_scheduler.h b/services/appmgr/include/ams_mgr_scheduler.h index 64d6b1d34cd..b6e91b5b8da 100644 --- a/services/appmgr/include/ams_mgr_scheduler.h +++ b/services/appmgr/include/ams_mgr_scheduler.h @@ -51,7 +51,8 @@ public: * @return */ virtual void LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo) override; + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const AAFwk::Want &want) override; /** * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 6d38e4a0c07..2f8dd7840fe 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -67,11 +67,13 @@ public: * @param preToken, the unique identification to call the ability. * @param abilityInfo, the ability information. * @param appInfo, the app information. + * @param want the ability want. * * @return */ virtual void LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo); + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const std::shared_ptr &want); /** * TerminateAbility, terminate the token ability. diff --git a/services/appmgr/src/ability_running_record.cpp b/services/appmgr/src/ability_running_record.cpp index 8c218661ec3..b925653d4bc 100644 --- a/services/appmgr/src/ability_running_record.cpp +++ b/services/appmgr/src/ability_running_record.cpp @@ -19,8 +19,8 @@ namespace OHOS { namespace AppExecFwk { -AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr &info, const sptr &token) - : info_(info), token_(token) +AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr &info, const sptr &token, + const std::shared_ptr &want) : info_(info), token_(token), want_(want) {} AbilityRunningRecord::~AbilityRunningRecord() @@ -36,6 +36,11 @@ const std::shared_ptr &AbilityRunningRecord::GetAbilityInfo() const return info_; } +const std::shared_ptr &AbilityRunningRecord::GetWant() const +{ + return want_; +} + const sptr &AbilityRunningRecord::GetToken() const { return token_; diff --git a/services/appmgr/src/ams_mgr_scheduler.cpp b/services/appmgr/src/ams_mgr_scheduler.cpp index 90019d2fbe1..1f4b27280ca 100644 --- a/services/appmgr/src/ams_mgr_scheduler.cpp +++ b/services/appmgr/src/ams_mgr_scheduler.cpp @@ -51,7 +51,8 @@ AmsMgrScheduler::~AmsMgrScheduler() } void AmsMgrScheduler::LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo) + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const AAFwk::Want &want) { if (!abilityInfo || !appInfo) { APP_LOGE("param error"); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 53fdabdc245..e2babfb9325 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -87,7 +87,8 @@ AppMgrServiceInner::~AppMgrServiceInner() {} void AppMgrServiceInner::LoadAbility(const sptr &token, const sptr &preToken, - const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo) + const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, + const std::shared_ptr &want) { BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); if (!CheckLoadabilityConditions(token, abilityInfo, appInfo)) { -- Gitee From c89608321d7f7e2383dd4ac9b77810f5f1a2af35 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 11:54:06 +0800 Subject: [PATCH 2/9] add params Signed-off-by: unknown --- interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp index 31e49678d2e..3ed6fdb645d 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -112,7 +112,7 @@ ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply) return ERR_APPEXECFWK_PARCEL_ERROR; } - std::shared_ptr want(data.ReadParcelable()); + std::shared_ptr want(data.ReadParcelable()); if (!want) { APP_LOGE("ReadParcelable want failed"); return ERR_APPEXECFWK_PARCEL_ERROR; -- Gitee From 7871e46e8be651c4b4c46f117733295700f81be7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 11:58:22 +0800 Subject: [PATCH 3/9] add param Signed-off-by: unknown --- interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp index 3ed6fdb645d..eb7e502a844 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -118,7 +118,6 @@ ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply) return ERR_APPEXECFWK_PARCEL_ERROR; } - LoadAbility(token, preToke, abilityInfo, appInfo, want); return NO_ERROR; } -- Gitee From c9753dcd626421bf632eb25a5593a6241090708c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 14:54:59 +0800 Subject: [PATCH 4/9] add param Signed-off-by: unknown --- interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp index 364edd93813..6371b897d39 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp @@ -37,7 +37,7 @@ bool AmsMgrProxy::WriteInterfaceToken(MessageParcel &data) void AmsMgrProxy::LoadAbility(const sptr &token, const sptr &preToken, const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, - const AAFwk::Want &want) + const std::shared_ptr &want) { APP_LOGD("start"); if (!abilityInfo || !appInfo) { -- Gitee From c854b6fb81b154b8fbd2a54c26037295a3cb27ea Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 15:01:39 +0800 Subject: [PATCH 5/9] add params Signed-off-by: unknown --- .../innerkits/app_manager/include/appmgr/ams_mgr_interface.h | 2 +- interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h | 2 +- services/appmgr/src/ams_mgr_scheduler.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h index be4ccdbebf1..0656a1b6243 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h +++ b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_interface.h @@ -44,7 +44,7 @@ public: */ virtual void LoadAbility(const sptr &token, const sptr &preToken, const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, - const AAFwk::Want &want) = 0; + const std::shared_ptr &want) = 0; /** * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. diff --git a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h index 29c2470671c..ef95912b1a2 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h +++ b/interfaces/innerkits/app_manager/include/appmgr/ams_mgr_proxy.h @@ -38,7 +38,7 @@ public: */ virtual void LoadAbility(const sptr &token, const sptr &preToken, const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, - const AAFwk::Want &want) override; + const std::shared_ptr &want) override; /** * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. diff --git a/services/appmgr/src/ams_mgr_scheduler.cpp b/services/appmgr/src/ams_mgr_scheduler.cpp index 1f4b27280ca..dba00125c85 100644 --- a/services/appmgr/src/ams_mgr_scheduler.cpp +++ b/services/appmgr/src/ams_mgr_scheduler.cpp @@ -52,7 +52,7 @@ AmsMgrScheduler::~AmsMgrScheduler() void AmsMgrScheduler::LoadAbility(const sptr &token, const sptr &preToken, const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, - const AAFwk::Want &want) + const std::shared_ptr &want) { if (!abilityInfo || !appInfo) { APP_LOGE("param error"); -- Gitee From 51b58606dfabb38dd16abb312d67b74c3f79130f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 15:28:59 +0800 Subject: [PATCH 6/9] add params Signed-off-by: unknown --- interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp | 2 +- .../innerkits/app_manager/src/appmgr/app_mgr_client.cpp | 2 +- services/appmgr/include/ability_running_record.h | 4 ++-- services/appmgr/include/ams_mgr_scheduler.h | 2 +- services/appmgr/src/ability_running_record.cpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp index 6371b897d39..d1b349653f5 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_proxy.cpp @@ -55,7 +55,7 @@ void AmsMgrProxy::LoadAbility(const sptr &token, const sptr &token, con std::shared_ptr abilityInfoPtr = std::make_shared(abilityInfo); std::shared_ptr appInfoPtr = std::make_shared(appInfo); std::shared_ptr wantPtr = std::make_shared(want); - amsService->LoadAbility(token, preToken, abilityInfoPtr, appInfoPtr, want); + amsService->LoadAbility(token, preToken, abilityInfoPtr, appInfoPtr, wantPtr); return AppMgrResultCode::RESULT_OK; } } diff --git a/services/appmgr/include/ability_running_record.h b/services/appmgr/include/ability_running_record.h index f415966d4fc..df9dad5efa3 100644 --- a/services/appmgr/include/ability_running_record.h +++ b/services/appmgr/include/ability_running_record.h @@ -29,8 +29,8 @@ namespace OHOS { namespace AppExecFwk { class AbilityRunningRecord { public: - AbilityRunningRecord(const std::shared_ptr &info, const sptr &token, - const std::shared_ptr &want); + AbilityRunningRecord(const std::shared_ptr &info, const std::shared_ptr &want, + const sptr &token); virtual ~AbilityRunningRecord(); /** diff --git a/services/appmgr/include/ams_mgr_scheduler.h b/services/appmgr/include/ams_mgr_scheduler.h index b6e91b5b8da..a148acf9c8f 100644 --- a/services/appmgr/include/ams_mgr_scheduler.h +++ b/services/appmgr/include/ams_mgr_scheduler.h @@ -52,7 +52,7 @@ public: */ virtual void LoadAbility(const sptr &token, const sptr &preToken, const std::shared_ptr &abilityInfo, const std::shared_ptr &appInfo, - const AAFwk::Want &want) override; + const std::shared_ptr &want) override; /** * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. diff --git a/services/appmgr/src/ability_running_record.cpp b/services/appmgr/src/ability_running_record.cpp index b925653d4bc..bb0ebabc604 100644 --- a/services/appmgr/src/ability_running_record.cpp +++ b/services/appmgr/src/ability_running_record.cpp @@ -19,8 +19,8 @@ namespace OHOS { namespace AppExecFwk { -AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr &info, const sptr &token, - const std::shared_ptr &want) : info_(info), token_(token), want_(want) +AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr &info, const std::shared_ptr &want, + const sptr &token) : info_(info), want_(want), token_(token) {} AbilityRunningRecord::~AbilityRunningRecord() -- Gitee From 316d53327c0b400d5aef07f143c066dc374f9a83 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 19:05:08 +0800 Subject: [PATCH 7/9] add param Signed-off-by: unknown --- services/appmgr/include/ability_running_record.h | 7 ++++--- services/appmgr/src/ability_running_record.cpp | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/services/appmgr/include/ability_running_record.h b/services/appmgr/include/ability_running_record.h index df9dad5efa3..10e363b41a3 100644 --- a/services/appmgr/include/ability_running_record.h +++ b/services/appmgr/include/ability_running_record.h @@ -29,8 +29,7 @@ namespace OHOS { namespace AppExecFwk { class AbilityRunningRecord { public: - AbilityRunningRecord(const std::shared_ptr &info, const std::shared_ptr &want, - const sptr &token); + AbilityRunningRecord(const std::shared_ptr &info, const sptr &token); virtual ~AbilityRunningRecord(); /** @@ -54,6 +53,8 @@ public: */ const std::shared_ptr &GetWant() const; + void SetWant(const std::shared_ptr &want); + /** * @brief Obtains the token of the ability. * @@ -178,7 +179,7 @@ private: bool isTerminating_ = false; AbilityState state_ = AbilityState::ABILITY_STATE_BEGIN; std::shared_ptr info_; - std::shared_ptr want_; + std::shared_ptr want_ = nullptr; sptr token_; sptr preToken_; }; diff --git a/services/appmgr/src/ability_running_record.cpp b/services/appmgr/src/ability_running_record.cpp index bb0ebabc604..4b77e95f315 100644 --- a/services/appmgr/src/ability_running_record.cpp +++ b/services/appmgr/src/ability_running_record.cpp @@ -19,8 +19,8 @@ namespace OHOS { namespace AppExecFwk { -AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr &info, const std::shared_ptr &want, - const sptr &token) : info_(info), want_(want), token_(token) +AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr &info, const sptr &token) + : info_(info), token_(token) {} AbilityRunningRecord::~AbilityRunningRecord() @@ -41,6 +41,11 @@ const std::shared_ptr &AbilityRunningRecord::GetWant() const return want_; } +void AbilityRunningRecord::SetWant(const std::shared_ptr &want) +{ + want_ = want; +} + const sptr &AbilityRunningRecord::GetToken() const { return token_; -- Gitee From 5efba8e7ccfe3be9175e56dd06a5ddcbd83cfaf0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 20:06:19 +0800 Subject: [PATCH 8/9] add param Signed-off-by: unknown --- services/abilitymgr/src/ability_connect_manager.cpp | 4 ++-- services/appmgr/src/ams_mgr_scheduler.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index f56e06fac78..ed4f65c4d27 100755 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -585,8 +585,8 @@ void AbilityConnectManager::LoadAbility(const std::shared_ptr &ab } } } - DelayedSingleton::GetInstance()->LoadAbility( - token, perToken, abilityRecord->GetAbilityInfo(), abilityRecord->GetApplicationInfo()); + DelayedSingleton::GetInstance()->LoadAbility(token, perToken, abilityRecord->GetAbilityInfo(), + abilityRecord->GetApplicationInfo(), abilityRecord->GetWant()); abilityRecord->SetStartTime(); } diff --git a/services/appmgr/src/ams_mgr_scheduler.cpp b/services/appmgr/src/ams_mgr_scheduler.cpp index dba00125c85..8620d3962c1 100644 --- a/services/appmgr/src/ams_mgr_scheduler.cpp +++ b/services/appmgr/src/ams_mgr_scheduler.cpp @@ -65,7 +65,7 @@ void AmsMgrScheduler::LoadAbility(const sptr &token, const sptr loadAbilityFunc = - std::bind(&AppMgrServiceInner::LoadAbility, amsMgrServiceInner_, token, preToken, abilityInfo, appInfo); + std::bind(&AppMgrServiceInner::LoadAbility, amsMgrServiceInner_, token, preToken, abilityInfo, appInfo, want); amsHandler_->PostTask(loadAbilityFunc, TASK_LOAD_ABILITY); } -- Gitee From 7266fd689001902442b7e91e021ab857890eb2ab Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2022 20:40:25 +0800 Subject: [PATCH 9/9] add param Signed-off-by: unknown --- .../ams_app_death_recipient_test.cpp | 2 +- .../ams_app_life_cycle_test.cpp | 10 +++++----- .../ams_app_mgr_client_test.cpp | 5 +++-- .../ams_app_running_record_test.cpp | 8 ++++---- .../ams_mgr_scheduler_test.cpp | 12 ++++++------ .../ams_recent_app_list_test.cpp | 12 ++++++------ .../ams_app_recent_list_module_test.cpp | 6 +++--- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/services/appmgr/test/unittest/ams_app_death_recipient_test/ams_app_death_recipient_test.cpp b/services/appmgr/test/unittest/ams_app_death_recipient_test/ams_app_death_recipient_test.cpp index d87a6d53b79..ebdea2b92f0 100644 --- a/services/appmgr/test/unittest/ams_app_death_recipient_test/ams_app_death_recipient_test.cpp +++ b/services/appmgr/test/unittest/ams_app_death_recipient_test/ams_app_death_recipient_test.cpp @@ -141,7 +141,7 @@ sptr AppDeathRecipientTest::GetApp(int32_t pid, int size) std::shared_ptr mockClientstr(mockClientPtr); appMgrServiceInner_->SetAppSpawnClient(mockClientstr); - appMgrServiceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + appMgrServiceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); auto appRecord = GetAppRunningRecordByIndex(pid); diff --git a/services/appmgr/test/unittest/ams_app_life_cycle_test/ams_app_life_cycle_test.cpp b/services/appmgr/test/unittest/ams_app_life_cycle_test/ams_app_life_cycle_test.cpp index 2b4ebe05821..5319750ca91 100644 --- a/services/appmgr/test/unittest/ams_app_life_cycle_test/ams_app_life_cycle_test.cpp +++ b/services/appmgr/test/unittest/ams_app_life_cycle_test/ams_app_life_cycle_test.cpp @@ -120,7 +120,7 @@ std::shared_ptr AmsAppLifeCycleTest::StartProcessAndLoadAbilit serviceInner_->SetAppSpawnClient(mockClientPtr); - serviceInner_->LoadAbility(token, preToken, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, preToken, abilityInfo, appInfo, nullptr); BundleInfo bundleInfo; bundleInfo.appId = "com.ohos.test.helloworld_code123"; auto record = serviceInner_->appRunningManager_->CheckAppRunningRecordIsExist( @@ -282,7 +282,7 @@ std::shared_ptr AmsAppLifeCycleTest::AddNewAbility( { auto newAbilityInfo = GetAbilityInfoByIndex(index); sptr newToken = new (std::nothrow) MockAbilityToken(); - serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, GetApplication()); + serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, GetApplication(), nullptr); auto newAbilityRecord = appRecord->GetAbilityRunningRecordByToken(newToken); EXPECT_NE(newAbilityRecord, nullptr); return newAbilityRecord; @@ -296,7 +296,7 @@ std::shared_ptr AmsAppLifeCycleTest::AddNewAbility( auto app = GetApplication(); app->uid = uid; sptr newToken = new (std::nothrow) MockAbilityToken(); - serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, app); + serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, app, nullptr); auto newAbilityRecord = appRecord->GetAbilityRunningRecordByToken(newToken); EXPECT_NE(newAbilityRecord, nullptr); return newAbilityRecord; @@ -1382,7 +1382,7 @@ HWTEST_F(AmsAppLifeCycleTest, Stop_001, TestSize.Level1) EXPECT_NE(abilityRecord, nullptr); AbilityState abilityState = abilityRecord->GetState(); ApplicationState appState = appRecord->GetState(); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(abilityState, abilityRecord->GetState()); EXPECT_EQ(appState, appRecord->GetState()); @@ -1495,7 +1495,7 @@ HWTEST_F(AmsAppLifeCycleTest, KillApplication_002, TestSize.Level1) serviceInner_->SetAppSpawnClient(mockClientPtr); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); BundleInfo bundleInfo; bundleInfo.appId = "com.ohos.test.helloworld_code123"; auto appRecord = serviceInner_->appRunningManager_->CheckAppRunningRecordIsExist( diff --git a/services/appmgr/test/unittest/ams_app_mgr_client_test/ams_app_mgr_client_test.cpp b/services/appmgr/test/unittest/ams_app_mgr_client_test/ams_app_mgr_client_test.cpp index 048ec60c740..2d552ffb3ee 100644 --- a/services/appmgr/test/unittest/ams_app_mgr_client_test/ams_app_mgr_client_test.cpp +++ b/services/appmgr/test/unittest/ams_app_mgr_client_test/ams_app_mgr_client_test.cpp @@ -81,16 +81,17 @@ HWTEST_F(AmsAppMgrClientTest, AppMgrClient_001, TestSize.Level1) AbilityInfo abilityInfo; ApplicationInfo appInfo; + Want want; sptr amsMgrScheduler(new MockAmsMgrScheduler()); - EXPECT_CALL(*(static_cast(amsMgrScheduler.GetRefPtr())), LoadAbility(_, _, _, _)).Times(1); + EXPECT_CALL(*(static_cast(amsMgrScheduler.GetRefPtr())), LoadAbility(_, _, _, _, _)).Times(1); EXPECT_CALL(*(static_cast(client_->remote_.GetRefPtr())), GetAmsMgr()) .Times(1) .WillOnce(Return(amsMgrScheduler)); - EXPECT_EQ(AppMgrResultCode::RESULT_OK, client_->LoadAbility(token_, preToken_, abilityInfo, appInfo)); + EXPECT_EQ(AppMgrResultCode::RESULT_OK, client_->LoadAbility(token_, preToken_, abilityInfo, appInfo, want)); APP_LOGI("ams_app_mgr_client_test_001 end"); } diff --git a/services/appmgr/test/unittest/ams_app_running_record_test/ams_app_running_record_test.cpp b/services/appmgr/test/unittest/ams_app_running_record_test/ams_app_running_record_test.cpp index 514a4c646e6..066ef695ad2 100644 --- a/services/appmgr/test/unittest/ams_app_running_record_test/ams_app_running_record_test.cpp +++ b/services/appmgr/test/unittest/ams_app_running_record_test/ams_app_running_record_test.cpp @@ -136,7 +136,7 @@ std::shared_ptr AmsAppRunningRecordTest::StartLoadAbility(cons service_->SetAppSpawnClient(mockClientPtr); EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(newPid), Return(ERR_OK))); - service_->LoadAbility(token, nullptr, abilityInfo, appInfo); + service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); BundleInfo bundleInfo; bundleInfo.appId = "com.ohos.test.helloworld_code123"; @@ -720,9 +720,9 @@ HWTEST_F(AmsAppRunningRecordTest, AttachApplication_006, TestSize.Level1) auto record = StartLoadAbility(token, abilityInfo, appInfo, PID); sptr token2 = new (std::nothrow) MockAbilityToken(); - service_->LoadAbility(token2, nullptr, abilityInfo2, appInfo); + service_->LoadAbility(token2, nullptr, abilityInfo2, appInfo, nullptr); sptr token3 = new (std::nothrow) MockAbilityToken(); - service_->LoadAbility(token3, nullptr, abilityInfo3, appInfo); + service_->LoadAbility(token3, nullptr, abilityInfo3, appInfo, nullptr); EXPECT_EQ(record->GetAbilities().size(), EXPECT_RECORD_SIZE); EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(1); @@ -911,7 +911,7 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbilityForApp_004, TestSize.Level1) EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(0); EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _)).Times(1); sptr token2 = new (std::nothrow) MockAbilityToken(); - service_->LoadAbility(token2, nullptr, abilityInfo2, appInfo); + service_->LoadAbility(token2, nullptr, abilityInfo2, appInfo, nullptr); APP_LOGI("AmsAppRunningRecordTest LaunchAbilityForApp_004 end"); } diff --git a/services/appmgr/test/unittest/ams_mgr_scheduler_test/ams_mgr_scheduler_test.cpp b/services/appmgr/test/unittest/ams_mgr_scheduler_test/ams_mgr_scheduler_test.cpp index 6734c2ef131..85f35cacbda 100644 --- a/services/appmgr/test/unittest/ams_mgr_scheduler_test/ams_mgr_scheduler_test.cpp +++ b/services/appmgr/test/unittest/ams_mgr_scheduler_test/ams_mgr_scheduler_test.cpp @@ -114,9 +114,9 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_001, TestSize.Level1) std::shared_ptr applicationInfo = std::make_shared(); applicationInfo->name = GetTestAppName(); - EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _)) + EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)) .WillOnce(InvokeWithoutArgs(mockAppMgrServiceInner.get(), &MockAppMgrServiceInner::Post)); - amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, applicationInfo); + amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, applicationInfo, nullptr); mockAppMgrServiceInner->Wait(); APP_LOGD("AmsMgrScheduler_001 end."); @@ -148,12 +148,12 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_002, TestSize.Level1) applicationInfo->name = GetTestAppName(); // check token parameter - EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _)).Times(0); - amsMgrScheduler->LoadAbility(token, preToken, nullptr, applicationInfo); + EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)).Times(0); + amsMgrScheduler->LoadAbility(token, preToken, nullptr, applicationInfo, nullptr); // check pretoken parameter - EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _)).Times(0); - amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, nullptr); + EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)).Times(0); + amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, nullptr, nullptr); APP_LOGD("AmsMgrScheduler_002 end."); } diff --git a/services/appmgr/test/unittest/ams_recent_app_list_test/ams_recent_app_list_test.cpp b/services/appmgr/test/unittest/ams_recent_app_list_test/ams_recent_app_list_test.cpp index fda095275ba..232f3340649 100644 --- a/services/appmgr/test/unittest/ams_recent_app_list_test/ams_recent_app_list_test.cpp +++ b/services/appmgr/test/unittest/ams_recent_app_list_test/ams_recent_app_list_test.cpp @@ -116,7 +116,7 @@ void AmsRecentAppListTest::StartProcessSuccess(const int32_t index) const EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK))); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockClientPtr)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); return; } @@ -160,7 +160,7 @@ HWTEST_F(AmsRecentAppListTest, Create_002, TestSize.Level1) EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).WillOnce(Return(ERR_APPEXECFWK_ASSEMBLE_START_MSG_FAILED)); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockClientPtr)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_TRUE(serviceInner_->GetRecentAppList().empty()); } @@ -187,11 +187,11 @@ HWTEST_F(AmsRecentAppListTest, Create_003, TestSize.Level1) EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK))); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockClientPtr)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(INDEX_NUM_1, static_cast(serviceInner_->GetRecentAppList().size())); // Load ability1, start process 1 again. - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(INDEX_NUM_1, static_cast(serviceInner_->GetRecentAppList().size())); } @@ -381,7 +381,7 @@ HWTEST_F(AmsRecentAppListTest, RecentAppList_001, TestSize.Level1) EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK))); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockClientPtr)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(INDEX_NUM_1, static_cast(serviceInner_->GetRecentAppList().size())); auto appRecord = GetAppRunningRecordByIndex(INDEX_NUM_1); serviceInner_->AddAppDeathRecipient(pid, nullptr); @@ -409,7 +409,7 @@ HWTEST_F(AmsRecentAppListTest, PushAppFront_001, TestSize.Level1) EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK))); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockClientPtr)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(INDEX_NUM_1, static_cast(serviceInner_->GetRecentAppList().size())); auto appRecord = GetAppRunningRecordByIndex(INDEX_NUM_1); serviceInner_->PushAppFront(appRecord->GetRecordId()); diff --git a/services/test/moduletest/common/ams/app_recent_list_test/ams_app_recent_list_module_test.cpp b/services/test/moduletest/common/ams/app_recent_list_test/ams_app_recent_list_module_test.cpp index 6abb9ed978d..ba7660d8723 100644 --- a/services/test/moduletest/common/ams/app_recent_list_test/ams_app_recent_list_module_test.cpp +++ b/services/test/moduletest/common/ams/app_recent_list_test/ams_app_recent_list_module_test.cpp @@ -124,7 +124,7 @@ void AmsAppRecentListModuleTest::CreateAppRecentList(const int32_t appNum) .WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK))); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockedSpawnClient)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); } return; } @@ -157,7 +157,7 @@ HWTEST_F(AmsAppRecentListModuleTest, Create_Recent_List_001, TestSize.Level1) MockAppSpawnClient *mockedSpawnClient = new MockAppSpawnClient(); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockedSpawnClient)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(INDEX_NUM_10, static_cast(serviceInner_->GetRecentAppList().size())); APP_LOGI("Create_Recent_List_001 end"); } @@ -192,7 +192,7 @@ HWTEST_F(AmsAppRecentListModuleTest, Create_Recent_List_002, TestSize.Level1) EXPECT_CALL(*mockedSpawnClient, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK))); serviceInner_->SetAppSpawnClient(std::unique_ptr(mockedSpawnClient)); - serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo); + serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr); EXPECT_EQ(INDEX_NUM_10 + INDEX_NUM_1, static_cast(serviceInner_->GetRecentAppList().size())); APP_LOGI("Create_Recent_List_002 end"); } -- Gitee