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 a61aefdfe538e91c328c26f93ea5cddff282e78b..0656a1b624323f08482faad4504f2f94f1250b9f 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 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 8a58e6ef9f5d5179b3b37fed8e10ef7ffd1d2c44..ef95912b1a23909e26df8b2327ed6a486e576dc7 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 std::shared_ptr &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 3ef4eb1799d26043eb0bb05361ace8bd3543f4d8..87185599845932edfd65fbf29bee8eca857aaa76 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 effa2e7d6798bc3c295847e861a934c079e5bec5..d1b349653f5b1691c0ab686c3d20f310cb7fc3f0 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 std::shared_ptr &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 b9ad246fa302f2ffaf435b54787a652025164f73..eb7e502a84410a65efdeb1a457493561726f0c6d 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,13 @@ 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 a19edea671213bc2611ada0e3d3295ec609d5c44..2af80c061a40430fd8944d83af1f818554942317 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, wantPtr); return AppMgrResultCode::RESULT_OK; } } diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index 1a4382adbc0b412bdf4f5a16b000bbce8bc2ac7b..0576e6c8ac4f6cb65ca258d652bdc3ec105ab017 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_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index f56e06fac78b8f7683eaf393e7b2dcddf917f75f..ed4f65c4d274a588448e938838877426ef35bd45 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/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index 90c73efb5bda9d2bf5b4be75508c4a9429c2603b..ec5bc27db9a71a14bd03e9558a851c3a00756b79 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 e047ef049f228babb666226ec7fbb06a74221c94..bbdf03f348ae1d0b84a7cbe2d1a5974389c2f0c1 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 102804069dfdc9a56ab59f530a70c8ad98daa5e6..74457168805124bcf81ec127c6da0c79982713f1 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 607c1fbf4d23bdc73ebfd6aee66594426065f213..75d514900ae4c6276a5737702648e1b466b96159 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 c5ad1856b2816ffaa29c3f8718678662ad29d556..30123d933773251ef8a352d487bfefdbf1aafc6a 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 033011f7eb4c160aabb4fc3f87114847323326b3..45bb32bf958c266f3d6ddd98b98ff110d609791e 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 eee811ed0a08cfc6fa4fb92640dbf233afbba475..10e363b41a3c5ea362af91fca5eac0c2666c7013 100644 --- a/services/appmgr/include/ability_running_record.h +++ b/services/appmgr/include/ability_running_record.h @@ -23,6 +23,7 @@ #include "ability_info.h" #include "application_info.h" #include "app_mgr_constants.h" +#include "want.h" namespace OHOS { namespace AppExecFwk { @@ -45,6 +46,15 @@ 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; + + void SetWant(const std::shared_ptr &want); + /** * @brief Obtains the token of the ability. * @@ -169,6 +179,7 @@ private: bool isTerminating_ = false; AbilityState state_ = AbilityState::ABILITY_STATE_BEGIN; std::shared_ptr info_; + std::shared_ptr want_ = nullptr; sptr token_; sptr preToken_; }; diff --git a/services/appmgr/include/ams_mgr_scheduler.h b/services/appmgr/include/ams_mgr_scheduler.h index 64d6b1d34cd00b341d9b96a7683886f1829b57c3..a148acf9c8fe149c656c6599d5a85327f1fad2f0 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 std::shared_ptr &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 6d38e4a0c079e9a394369b8e80b4ee6fd2c8aafc..2f8dd7840feba357146eb460d07fffe5453854e4 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 8c218661ec38c399f09080472457c835c024f055..4b77e95f315149f412b48ecae2e69bdb52f32f25 100644 --- a/services/appmgr/src/ability_running_record.cpp +++ b/services/appmgr/src/ability_running_record.cpp @@ -36,6 +36,16 @@ const std::shared_ptr &AbilityRunningRecord::GetAbilityInfo() const return info_; } +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_; diff --git a/services/appmgr/src/ams_mgr_scheduler.cpp b/services/appmgr/src/ams_mgr_scheduler.cpp index 90019d2fbe1b8e564b756556fa1f87fad52dc5e1..8620d3962c1d1b3df7dc46b94aecc1a7ab0425b0 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 std::shared_ptr &want) { if (!abilityInfo || !appInfo) { APP_LOGE("param error"); @@ -64,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); } diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 53fdabdc245ff6b53642a4381516b8cc8bef193a..e2babfb93250ea51306f8e9e7f59d9ec01015ca5 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)) { 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 d87a6d53b79f04fb4a6683060f739e00993ecb61..ebdea2b92f030d9dd5aa624cb44ebc97e7538b40 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 2b4ebe05821c043a7d64bb327103a09bc60bf6a5..5319750ca91c7f1a061b4cb8caa440b56738bcf2 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 048ec60c7404422eda0fe5093123b0cff0b2c293..2d552ffb3ee6a14ed16845f5629b2fbdca9e06e6 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 514a4c646e667b2f1649ead84a27b359490990f9..066ef695ad22e5a973ce73fae9eae7a153b2c3d3 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 6734c2ef1319131bb2e9c1c6a80b85d710ea1f83..85f35cacbda5657d235f2faef365745ce7d58a1d 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 fda095275ba9996b2923ee44bfaf40d380ca9e48..232f33406499d081b191695bdb1eef564f688ff4 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 6abb9ed978dc6f15483cdac4800bfde2a61eb403..ba7660d872338d1be7a2c501abfde5c9250044a6 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"); }