mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
!1026 fix continue mission invaid src and dst error code
Merge pull request !1026 from 仝月姣/master
This commit is contained in:
commit
bc430105e4
@ -466,6 +466,10 @@ enum {
|
|||||||
* Result(29360231) for all connect manager reject connect apply.
|
* Result(29360231) for all connect manager reject connect apply.
|
||||||
*/
|
*/
|
||||||
DMS_CONNECT_APPLY_REJECT_FAILED = 29360231,
|
DMS_CONNECT_APPLY_REJECT_FAILED = 29360231,
|
||||||
|
/**
|
||||||
|
* Result(29360232) for all connect manager reject connect apply.
|
||||||
|
*/
|
||||||
|
DMS_CONNECT_APPLY_TIMEOUT_FAILED = 29360232,
|
||||||
};
|
};
|
||||||
} // namespace DistributedSchedule
|
} // namespace DistributedSchedule
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -121,6 +121,11 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
|
|||||||
HILOGE("get local deviceId failed!");
|
HILOGE("get local deviceId failed!");
|
||||||
return INVALID_PARAMETERS_ERR;
|
return INVALID_PARAMETERS_ERR;
|
||||||
}
|
}
|
||||||
|
if (localDevId != srcDeviceId && localDevId != dstDeviceId) {
|
||||||
|
HILOGE("Input srcDevId: %{public}s or dstDevId: %{public}s must be locDevId: %{public}s.",
|
||||||
|
GetAnonymStr(srcDeviceId).c_str(), GetAnonymStr(dstDeviceId).c_str(), GetAnonymStr(localDevId).c_str());
|
||||||
|
return OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET;
|
||||||
|
}
|
||||||
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(
|
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(
|
||||||
localDevId == srcDeviceId ? dstDeviceId : srcDeviceId) == nullptr) {
|
localDevId == srcDeviceId ? dstDeviceId : srcDeviceId) == nullptr) {
|
||||||
HILOGE("GetDeviceInfoById fail, locDevId: %{public}s, srcDevId: %{public}s, dstDevId: %{public}s.",
|
HILOGE("GetDeviceInfoById fail, locDevId: %{public}s, srcDevId: %{public}s, dstDevId: %{public}s.",
|
||||||
@ -182,6 +187,11 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
|
|||||||
HILOGE("get local deviceId failed!");
|
HILOGE("get local deviceId failed!");
|
||||||
return INVALID_PARAMETERS_ERR;
|
return INVALID_PARAMETERS_ERR;
|
||||||
}
|
}
|
||||||
|
if (localDevId != srcDeviceId && localDevId != dstDeviceId) {
|
||||||
|
HILOGE("Input srcDevId: %{public}s or dstDevId: %{public}s must be locDevId: %{public}s.",
|
||||||
|
GetAnonymStr(srcDeviceId).c_str(), GetAnonymStr(dstDeviceId).c_str(), GetAnonymStr(localDevId).c_str());
|
||||||
|
return OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET;
|
||||||
|
}
|
||||||
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(
|
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(
|
||||||
localDevId == srcDeviceId ? dstDeviceId : srcDeviceId) == nullptr) {
|
localDevId == srcDeviceId ? dstDeviceId : srcDeviceId) == nullptr) {
|
||||||
HILOGE("GetDeviceInfoById fail, locDevId: %{public}s, srcDevId: %{public}s, dstDevId: %{public}s.",
|
HILOGE("GetDeviceInfoById fail, locDevId: %{public}s, srcDevId: %{public}s, dstDevId: %{public}s.",
|
||||||
@ -288,7 +298,7 @@ void DSchedContinueManager::WaitAllConnectDecision(int32_t direction, const DSch
|
|||||||
peerConnectDecision_.erase(peerDeviceId);
|
peerConnectDecision_.erase(peerDeviceId);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SetTimeOut(info, CONTINUE_TIMEOUT);
|
SetTimeOut(info, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSchedContinueManager::SetTimeOut(const DSchedContinueInfo &info, int32_t timeout)
|
void DSchedContinueManager::SetTimeOut(const DSchedContinueInfo &info, int32_t timeout)
|
||||||
|
@ -232,7 +232,7 @@ int32_t DSchedAllConnectManager::WaitAllConnectApplyCb(const std::string &peerNe
|
|||||||
|
|
||||||
if (peerConnectDecision_.find(peerNetworkId) == peerConnectDecision_.end()) {
|
if (peerConnectDecision_.find(peerNetworkId) == peerConnectDecision_.end()) {
|
||||||
HILOGE("Not find peerNetworkId %{public}s in peerConnectDecision.", GetAnonymStr(peerNetworkId).c_str());
|
HILOGE("Not find peerNetworkId %{public}s in peerConnectDecision.", GetAnonymStr(peerNetworkId).c_str());
|
||||||
return CONTINUE_ABILITY_TIMEOUT_ERR;
|
return DMS_CONNECT_APPLY_TIMEOUT_FAILED;
|
||||||
}
|
}
|
||||||
int32_t ret = peerConnectDecision_.at(peerNetworkId).load() ? ERR_OK : DMS_CONNECT_APPLY_REJECT_FAILED;
|
int32_t ret = peerConnectDecision_.at(peerNetworkId).load() ? ERR_OK : DMS_CONNECT_APPLY_REJECT_FAILED;
|
||||||
HILOGI("Wait all connect apply decision callback end, peerNetworkId %{public}s, isSupport %{public}d.",
|
HILOGI("Wait all connect apply decision callback end, peerNetworkId %{public}s, isSupport %{public}d.",
|
||||||
|
@ -115,7 +115,7 @@ HWTEST_F(DSchedContinueManagerTest, ContinueMission_001, TestSize.Level3)
|
|||||||
OHOS::AAFwk::WantParams wantParams;
|
OHOS::AAFwk::WantParams wantParams;
|
||||||
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
|
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
|
||||||
callback, wantParams);
|
callback, wantParams);
|
||||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
|
||||||
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_001 end" << std::endl;
|
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_001 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ HWTEST_F(DSchedContinueManagerTest, ContinueMission_002, TestSize.Level3)
|
|||||||
|
|
||||||
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
|
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
|
||||||
callback, wantParams);
|
callback, wantParams);
|
||||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
|
||||||
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_002 end" << std::endl;
|
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_002 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,10 +165,14 @@ HWTEST_F(DSchedContinueManagerTest, ContinueMission_003, TestSize.Level3)
|
|||||||
auto callback = GetDSchedService();
|
auto callback = GetDSchedService();
|
||||||
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, BUNDLE_NAME,
|
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, BUNDLE_NAME,
|
||||||
CONTINUETYPE, callback, wantParams);
|
CONTINUETYPE, callback, wantParams);
|
||||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
|
||||||
|
|
||||||
std::string locDevId;
|
std::string locDevId;
|
||||||
EXPECT_EQ(true, DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(locDevId));
|
EXPECT_EQ(true, DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(locDevId));
|
||||||
|
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, locDevId, BUNDLE_NAME,
|
||||||
|
CONTINUETYPE, callback, wantParams);
|
||||||
|
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
||||||
|
|
||||||
ret = DSchedContinueManager::GetInstance().ContinueMission(locDevId, REMOTE_DEVICEID, BUNDLE_NAME,
|
ret = DSchedContinueManager::GetInstance().ContinueMission(locDevId, REMOTE_DEVICEID, BUNDLE_NAME,
|
||||||
CONTINUETYPE, callback, wantParams);
|
CONTINUETYPE, callback, wantParams);
|
||||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
||||||
|
Loading…
Reference in New Issue
Block a user