!906 函数名歧义&调用不当修复

Merge pull request !906 from yanghang/master
This commit is contained in:
openharmony_ci 2023-12-25 06:38:48 +00:00 committed by Gitee
commit 09be225858
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 13 additions and 13 deletions

View File

@ -353,7 +353,7 @@ private:
bool IsSameLoadSaItem(const std::string& srcNetworkId, int32_t systemAbilityId,
std::shared_ptr<DHandleEntryTxRx> loadSaItem);
std::shared_ptr<struct DHandleEntryTxRx> PopLoadSaItem(const std::string& srcNetworkId, int32_t systemAbilityId);
void SendMessageToRemote(uint32_t dBinderCode, uint32_t reason,
void SendReplyMessageToRemote(uint32_t dBinderCode, uint32_t reason,
std::shared_ptr<struct DHandleEntryTxRx> replyMessage);
private:

View File

@ -501,7 +501,7 @@ void DBinderService::LoadSystemAbilityComplete(const std::string& srcNetworkId,
break;
}
if (remoteObject == nullptr) {
SendMessageToRemote(MESSAGE_AS_REMOTE_ERROR, SA_NOT_FOUND, replyMessage);
SendReplyMessageToRemote(MESSAGE_AS_REMOTE_ERROR, SA_NOT_FOUND, replyMessage);
DBINDER_LOGE(LOG_LABEL, "GetSystemAbility from samgr error, saId:%{public}d", systemAbilityId);
continue;
}
@ -511,7 +511,7 @@ void DBinderService::LoadSystemAbilityComplete(const std::string& srcNetworkId,
/* When the stub object dies, you need to delete the corresponding busName information */
sptr<IRemoteObject::DeathRecipient> death(new DbinderSaDeathRecipient(binderObject));
if (!saProxy->AddDeathRecipient(death)) {
SendMessageToRemote(MESSAGE_AS_REMOTE_ERROR, SA_NOT_FOUND, replyMessage);
SendReplyMessageToRemote(MESSAGE_AS_REMOTE_ERROR, SA_NOT_FOUND, replyMessage);
DBINDER_LOGE(LOG_LABEL, "fail to add death recipient");
continue;
}
@ -521,7 +521,7 @@ void DBinderService::LoadSystemAbilityComplete(const std::string& srcNetworkId,
}
std::string deviceId = replyMessage->deviceIdInfo.fromDeviceId;
if (replyMessage->transType != IRemoteObject::DATABUS_TYPE) {
SendMessageToRemote(MESSAGE_AS_REMOTE_ERROR, SA_INVOKE_FAILED, replyMessage);
SendReplyMessageToRemote(MESSAGE_AS_REMOTE_ERROR, SA_INVOKE_FAILED, replyMessage);
DBINDER_LOGE(LOG_LABEL, "Invalid Message Type");
} else {
// peer device rpc version == 1, not support thokenId and message->deviceIdInfo.tokenId is random value
@ -530,16 +530,16 @@ void DBinderService::LoadSystemAbilityComplete(const std::string& srcNetworkId,
uint32_t result = OnRemoteInvokerDataBusMessage(saProxy, replyMessage.get(), deviceId,
replyMessage->pid, replyMessage->uid, tokenId);
if (result != 0) {
SendMessageToRemote(MESSAGE_AS_REMOTE_ERROR, result, replyMessage);
SendReplyMessageToRemote(MESSAGE_AS_REMOTE_ERROR, result, replyMessage);
continue;
}
SendMessageToRemote(MESSAGE_AS_REPLY, 0, replyMessage);
SendReplyMessageToRemote(MESSAGE_AS_REPLY, 0, replyMessage);
}
}
DBINDER_LOGI(LOG_LABEL, "LoadSystemAbility complete");
}
void DBinderService::SendMessageToRemote(uint32_t dBinderCode, uint32_t reason,
void DBinderService::SendReplyMessageToRemote(uint32_t dBinderCode, uint32_t reason,
std::shared_ptr<struct DHandleEntryTxRx> replyMessage)
{
std::shared_ptr<DBinderRemoteListener> remoteListener = GetRemoteListener();
@ -551,7 +551,7 @@ void DBinderService::SendMessageToRemote(uint32_t dBinderCode, uint32_t reason,
if (dBinderCode == MESSAGE_AS_REMOTE_ERROR) {
replyMessage->transType = reason; // reuse transType send back error code
}
if (!remoteListener->SendDataToRemote(replyMessage->deviceIdInfo.fromDeviceId, replyMessage.get())) {
if (!remoteListener->SendDataReply(replyMessage->deviceIdInfo.fromDeviceId, replyMessage.get())) {
DBINDER_LOGE(LOG_LABEL, "fail to send data from server DBS to client DBS");
}
}

View File

@ -1145,20 +1145,20 @@ HWTEST_F(DBinderServiceUnitTest, PopLoadSaItemTest001, TestSize.Level1)
}
/**
* @tc.name: SendMessageToRemote001
* @tc.desc: Verify the SendMessageToRemote function
* @tc.name: SendReplyMessageToRemote001
* @tc.desc: Verify the SendReplyMessageToRemote function
* @tc.type: FUNC
*/
HWTEST_F(DBinderServiceUnitTest, SendMessageToRemote001, TestSize.Level1)
HWTEST_F(DBinderServiceUnitTest, SendReplyMessageToRemote001, TestSize.Level1)
{
uint32_t dBinderCode = 4;
uint32_t reason = 0;
std::shared_ptr<DHandleEntryTxRx> replyMessage = std::make_shared<DHandleEntryTxRx>();
sptr<DBinderService> dBinderService = DBinderService::GetInstance();
dBinderService->remoteListener_ = std::make_shared<DBinderRemoteListener>(dBinderService);
dBinderService->SendMessageToRemote(dBinderCode, reason, replyMessage);
dBinderService->SendReplyMessageToRemote(dBinderCode, reason, replyMessage);
dBinderCode = 1;
dBinderService->SendMessageToRemote(dBinderCode, reason, replyMessage);
dBinderService->SendReplyMessageToRemote(dBinderCode, reason, replyMessage);
DBinderService *temp = new DBinderService();
DBinderService::instance_ = temp;
dBinderService = DBinderService::GetInstance();