diff --git a/services/dtbschedmgr/include/continue/dsched_continue.h b/services/dtbschedmgr/include/continue/dsched_continue.h index ecf687db..2cea7492 100644 --- a/services/dtbschedmgr/include/continue/dsched_continue.h +++ b/services/dtbschedmgr/include/continue/dsched_continue.h @@ -157,6 +157,7 @@ private: int32_t UpdateElementInfo(std::shared_ptr cmd); void FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType, std::vector &dmsAbilityInfos, std::vector &result); + void ContinueTypeFormat(std::string &continueType); int32_t ExecuteNotifyComplete(int32_t result); int32_t ExecuteContinueEnd(int32_t result); int32_t ExecuteContinueError(int32_t result); @@ -168,7 +169,6 @@ private: uint32_t accessToken); int32_t OnContinueDataCmd(std::shared_ptr cmd); int32_t OnNotifyComplete(int32_t missionId, bool isSuccess); - void ContinueTypeFormat(std::string &continueType); int32_t OnContinueEndCmd(std::shared_ptr cmd); int32_t OnContinueEnd(int32_t result); diff --git a/services/dtbschedmgr/src/continue/dsched_continue.cpp b/services/dtbschedmgr/src/continue/dsched_continue.cpp index 78bb97df..93c92b22 100644 --- a/services/dtbschedmgr/src/continue/dsched_continue.cpp +++ b/services/dtbschedmgr/src/continue/dsched_continue.cpp @@ -421,17 +421,6 @@ int32_t DSchedContinue::OnNotifyComplete(int32_t missionId, bool isSuccess) return ERR_OK; } - - -void DSchedContinue::ContinueTypeFormat(std::string &continueType) -{ - std::string suffix = QUICK_START_CONFIGURATION; - if (suffix.length() <= continueType.length() && - continueType.rfind(suffix) == (continueType.length() - suffix.length())) { - continueType = continueType.substr(0, continueType.rfind(QUICK_START_CONFIGURATION)); - } -} - int32_t DSchedContinue::OnContinueEndCmd(std::shared_ptr cmd) { HILOGI("called"); @@ -1019,7 +1008,7 @@ int32_t DSchedContinue::UpdateElementInfo(std::shared_ptr } void DSchedContinue::FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType, - std::vector &dmsAbilityInfos, std::vector &result) + std::vector &dmsAbilityInfos, std::vector &result) { bool sameModuleGot = false; for (const auto &abilityInfoElement: dmsAbilityInfos) { @@ -1049,6 +1038,15 @@ void DSchedContinue::FindSinkContinueAbilityInfo(const std::string &srcModuleNam } } +void DSchedContinue::ContinueTypeFormat(std::string &continueType) +{ + std::string suffix = QUICK_START_CONFIGURATION; + if (suffix.length() <= continueType.length() && + continueType.rfind(suffix) == (continueType.length() - suffix.length())) { + continueType = continueType.substr(0, continueType.rfind(QUICK_START_CONFIGURATION)); + } +} + int32_t DSchedContinue::UpdateWantForContinueType(OHOS::AAFwk::Want& want) { std::string srcAbilityName = want.GetElement().GetAbilityName(); diff --git a/services/dtbschedmgr/test/unittest/continue/dsched_continue_test.cpp b/services/dtbschedmgr/test/unittest/continue/dsched_continue_test.cpp index cf6f39ee..7ed179ce 100644 --- a/services/dtbschedmgr/test/unittest/continue/dsched_continue_test.cpp +++ b/services/dtbschedmgr/test/unittest/continue/dsched_continue_test.cpp @@ -33,6 +33,7 @@ namespace { const std::string BUNDLEMAME_1 = "bundleName"; const std::string CONTINUE_TYPE1 = "continueType1"; const std::string CONTINUE_TYPE2 = "continueType2"; + const std::string CONTINUE_TYPE3 = "continueType3"; const std::string CONTINUE_TYPE1_QUICK = "continueType1_ContinueQuickStart"; const std::string MODULE_NAME1 = "moduleName1"; const std::string MODULE_NAME2 = "moduleName2"; @@ -628,9 +629,9 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0017_2, TestSize.Level0) auto conti = std::make_shared(subType, direction, callback, info); conti->Init(); auto cmd = std::make_shared(); - // no continueType, diff module + // no same continueType, diff module EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true)); - cmd->continueType_ = CONTINUE_TYPE1; + cmd->continueType_ = CONTINUE_TYPE3; cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_SAME_AS_CONTINUE_TYPE, MODULE_NAME2); int32_t ret = conti->UpdateElementInfo(cmd); EXPECT_EQ(ret, CAN_NOT_FOUND_MODULE_ERR);