异moduleName可接续

Signed-off-by: MisterE <smart_e@126.com>
This commit is contained in:
MisterE 2024-11-21 14:19:44 +08:00
parent 0a72ac8ec9
commit d3a8f3c7f7
3 changed files with 14 additions and 15 deletions

View File

@ -157,6 +157,7 @@ private:
int32_t UpdateElementInfo(std::shared_ptr<DSchedContinueDataCmd> cmd); int32_t UpdateElementInfo(std::shared_ptr<DSchedContinueDataCmd> cmd);
void FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType, void FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType,
std::vector<DmsAbilityInfo> &dmsAbilityInfos, std::vector<DmsAbilityInfo> &result); std::vector<DmsAbilityInfo> &dmsAbilityInfos, std::vector<DmsAbilityInfo> &result);
void ContinueTypeFormat(std::string &continueType);
int32_t ExecuteNotifyComplete(int32_t result); int32_t ExecuteNotifyComplete(int32_t result);
int32_t ExecuteContinueEnd(int32_t result); int32_t ExecuteContinueEnd(int32_t result);
int32_t ExecuteContinueError(int32_t result); int32_t ExecuteContinueError(int32_t result);
@ -168,7 +169,6 @@ private:
uint32_t accessToken); uint32_t accessToken);
int32_t OnContinueDataCmd(std::shared_ptr<DSchedContinueDataCmd> cmd); int32_t OnContinueDataCmd(std::shared_ptr<DSchedContinueDataCmd> cmd);
int32_t OnNotifyComplete(int32_t missionId, bool isSuccess); int32_t OnNotifyComplete(int32_t missionId, bool isSuccess);
void ContinueTypeFormat(std::string &continueType);
int32_t OnContinueEndCmd(std::shared_ptr<DSchedContinueEndCmd> cmd); int32_t OnContinueEndCmd(std::shared_ptr<DSchedContinueEndCmd> cmd);
int32_t OnContinueEnd(int32_t result); int32_t OnContinueEnd(int32_t result);

View File

@ -421,17 +421,6 @@ int32_t DSchedContinue::OnNotifyComplete(int32_t missionId, bool isSuccess)
return ERR_OK; 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<DSchedContinueEndCmd> cmd) int32_t DSchedContinue::OnContinueEndCmd(std::shared_ptr<DSchedContinueEndCmd> cmd)
{ {
HILOGI("called"); HILOGI("called");
@ -1019,7 +1008,7 @@ int32_t DSchedContinue::UpdateElementInfo(std::shared_ptr<DSchedContinueDataCmd>
} }
void DSchedContinue::FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType, void DSchedContinue::FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType,
std::vector<DmsAbilityInfo> &dmsAbilityInfos, std::vector<DmsAbilityInfo> &result) std::vector<DmsAbilityInfo> &dmsAbilityInfos, std::vector<DmsAbilityInfo> &result)
{ {
bool sameModuleGot = false; bool sameModuleGot = false;
for (const auto &abilityInfoElement: dmsAbilityInfos) { 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) int32_t DSchedContinue::UpdateWantForContinueType(OHOS::AAFwk::Want& want)
{ {
std::string srcAbilityName = want.GetElement().GetAbilityName(); std::string srcAbilityName = want.GetElement().GetAbilityName();

View File

@ -33,6 +33,7 @@ namespace {
const std::string BUNDLEMAME_1 = "bundleName"; const std::string BUNDLEMAME_1 = "bundleName";
const std::string CONTINUE_TYPE1 = "continueType1"; const std::string CONTINUE_TYPE1 = "continueType1";
const std::string CONTINUE_TYPE2 = "continueType2"; const std::string CONTINUE_TYPE2 = "continueType2";
const std::string CONTINUE_TYPE3 = "continueType3";
const std::string CONTINUE_TYPE1_QUICK = "continueType1_ContinueQuickStart"; const std::string CONTINUE_TYPE1_QUICK = "continueType1_ContinueQuickStart";
const std::string MODULE_NAME1 = "moduleName1"; const std::string MODULE_NAME1 = "moduleName1";
const std::string MODULE_NAME2 = "moduleName2"; const std::string MODULE_NAME2 = "moduleName2";
@ -628,9 +629,9 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0017_2, TestSize.Level0)
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info); auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
conti->Init(); conti->Init();
auto cmd = std::make_shared<DSchedContinueDataCmd>(); auto cmd = std::make_shared<DSchedContinueDataCmd>();
// no continueType, diff module // no same continueType, diff module
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true)); 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); cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_SAME_AS_CONTINUE_TYPE, MODULE_NAME2);
int32_t ret = conti->UpdateElementInfo(cmd); int32_t ret = conti->UpdateElementInfo(cmd);
EXPECT_EQ(ret, CAN_NOT_FOUND_MODULE_ERR); EXPECT_EQ(ret, CAN_NOT_FOUND_MODULE_ERR);