Bug fix for unit test and update figure for readme

Signed-off-by: ql <qianli16@huawei.com>
Change-Id: I9892f3e5f1eefb2de5a6b273b68bec62dbe2abf3
This commit is contained in:
ql 2021-09-07 14:34:29 +08:00
parent c6bc0b9f4b
commit 10aabadf13
3 changed files with 11 additions and 2 deletions

BIN
figures/dms-transaction_zh.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -78,6 +78,10 @@ int32_t DistributedSchedService::StartRemoteAbility(const OHOS::AAFwk::Want& use
const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode) const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode)
{ {
std::string deviceId = userWant.GetElement().GetDeviceID(); std::string deviceId = userWant.GetElement().GetDeviceID();
if (deviceId.empty()) {
HILOGE("StartRemoteAbility check deviceId fail");
return INVALID_PARAMETERS_ERR;
}
sptr<IDistributedSched> remoteDms = GetRemoteDms(deviceId); sptr<IDistributedSched> remoteDms = GetRemoteDms(deviceId);
if (remoteDms == nullptr) { if (remoteDms == nullptr) {
HILOGE("StartRemoteAbility DMS get remoteDms failed"); HILOGE("StartRemoteAbility DMS get remoteDms failed");
@ -95,6 +99,11 @@ int32_t DistributedSchedService::StartAbilityFromRemote(const OHOS::AAFwk::Want&
const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode, const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode,
const CallerInfo& callerInfo, const AccountInfo& accountInfo) const CallerInfo& callerInfo, const AccountInfo& accountInfo)
{ {
std::string deviceId = userWant.GetElement().GetDeviceID();
if (deviceId.empty()) {
HILOGE("StartRemoteAbility check deviceId fail");
return INVALID_REMOTE_PARAMETERS_ERR;
}
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->Connect(); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->Connect();
if (err != ERR_OK) { if (err != ERR_OK) {
HILOGE("StartAbilityFromRemote connect ability server failed %{public}d", err); HILOGE("StartAbilityFromRemote connect ability server failed %{public}d", err);

View File

@ -251,8 +251,8 @@ HWTEST_F(DistributedSchedServiceTest, StartAbilityFromRemote_001, TestSize.Level
"com.ohos.distributedmusicplayer", "192.168.43.101", abilityInfo); "com.ohos.distributedmusicplayer", "192.168.43.101", abilityInfo);
int result2 = proxy->StartAbilityFromRemote(want, abilityInfo, 0, callerInfo, accountInfo); int result2 = proxy->StartAbilityFromRemote(want, abilityInfo, 0, callerInfo, accountInfo);
DTEST_LOG << "result2:" << result2 << std::endl; DTEST_LOG << "result2:" << result2 << std::endl;
EXPECT_EQ(static_cast<int>(INVALID_PARAMETERS_ERR), result1); EXPECT_EQ(static_cast<int>(INVALID_REMOTE_PARAMETERS_ERR), result1);
EXPECT_EQ(static_cast<int>(INVALID_PARAMETERS_ERR), result2); EXPECT_EQ(static_cast<int>(INVALID_REMOTE_PARAMETERS_ERR), result2);
DTEST_LOG << "DistributedSchedServiceTest StartAbilityFromRemote_001 end" << std::endl; DTEST_LOG << "DistributedSchedServiceTest StartAbilityFromRemote_001 end" << std::endl;
} }