Merge remote-tracking branch 'origin/master' into surface3

Change-Id: I244fc9f49cb1a2a0de0cbc8d1b0dd9fa77a903fe
This commit is contained in:
刘瓒
2024-01-15 16:28:55 +08:00
9 changed files with 12 additions and 95 deletions
@@ -73,7 +73,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de
return;
}
size_t jsonSize = inputData.size();
DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize);
DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize);
TYPE_WHITE_LIST_VEC vecWhiteList = inputData;
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
}
@@ -643,7 +643,7 @@ void DistributedInputClient::AddWhiteListInfos(const std::string &deviceId, cons
return;
}
size_t jsonSize = inputData.size();
DHLOGI("AddWhiteListInfosCb OnResult deviceId: %s, json str: %s, json size:%d.\n",
DHLOGI("AddWhiteListInfosCb OnResult deviceId: %s, json str: %s, json size:%zu.\n",
GetAnonyString(deviceId).c_str(), GetAnonyString(strJson).c_str(), jsonSize);
TYPE_WHITE_LIST_VEC vecWhiteList = inputData;
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
@@ -668,7 +668,7 @@ void DistributedInputClient::UpdateSinkScreenInfos(const std::string &strJson)
return;
}
size_t jsonSize = inputData.size();
DHLOGI("OnResult json str: %s, json size:%d.\n", GetAnonyString(strJson).c_str(), jsonSize);
DHLOGI("OnResult json str: %s, json size:%zu.\n", GetAnonyString(strJson).c_str(), jsonSize);
std::vector<std::vector<uint32_t>> transInfos = inputData;
for (auto info : transInfos) {
if (info.size() != SINK_SCREEN_INFO_SIZE) {
@@ -748,7 +748,7 @@ void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic
{
DHLOGI("ProjectWindowListener OnMessage!");
if (topic != DHTopic::TOPIC_SINK_PROJECT_WINDOW_INFO) {
DHLOGE("this topic is wrong, %d", static_cast<uint32_t>(topic));
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(topic));
return;
}
std::string srcDeviceId = "";
@@ -876,7 +876,7 @@ void DistributedInputSinkManager::PluginStartListener::OnMessage(const DHTopic t
{
DHLOGI("PluginStartListener OnMessage!");
if (topic != DHTopic::TOPIC_PHY_DEV_PLUGIN) {
DHLOGE("this topic is wrong, %d", static_cast<uint32_t>(topic));
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(topic));
return;
}
if (message.empty()) {
@@ -210,7 +210,7 @@ void DistributedInputSinkTransport::SendKeyStateNodeMsg(const int32_t sessionId,
DHLOGE("SendKeyStateNodeMsg error, sessionId <= 0.");
return;
}
DHLOGI("SendKeyStateNodeMsg sessionId: %d, btnCode: %d.", sessionId, btnCode);
DHLOGI("SendKeyStateNodeMsg sessionId: %d, btnCode: %u.", sessionId, btnCode);
nlohmann::json jsonStr;
jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_KEY_STATE;
jsonStr[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID] = dhId;
@@ -346,7 +346,7 @@ void DInputSourceListener::OnReceivedEventRemoteInput(const std::string deviceId
}
size_t jsonSize = inputData.size();
DHLOGD("OnReceivedEventRemoteInput called, deviceId: %s, json size:%d.",
DHLOGD("OnReceivedEventRemoteInput called, deviceId: %s, json size:%zu.",
GetAnonyString(deviceId).c_str(), jsonSize);
std::vector<RawEvent> mEventBuffer(jsonSize);
@@ -637,15 +637,6 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &srcId
if (srcId != localNetworkId) {
return RelayStartRemoteInputByType(srcId, sinkId, inputTypes, callback);
}
for (auto iter : staCallbacks_) {
if (iter.devId == sinkId && iter.inputTypes == inputTypes) {
DHLOGE("StartRemoteInput called, repeat call.");
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, "Dinput start use failed in already started.");
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK);
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
}
}
DInputClientStartInfo info {sinkId, inputTypes, callback};
staCallbacks_.push_back(info);
@@ -690,15 +681,6 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &srcId,
if (srcId != localNetworkId) {
return RelayStopRemoteInputByType(srcId, sinkId, inputTypes, callback);
}
for (auto iter : stpCallbacks_) {
if (iter.devId == sinkId && iter.inputTypes == inputTypes) {
DHLOGE("StopRemoteInput called, repeat call.");
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, "Dinput stop use failed in already stoped.");
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
}
}
DInputClientStopInfo info {sinkId, inputTypes, callback};
stpCallbacks_.push_back(info);
@@ -723,13 +705,6 @@ int32_t DistributedInputSourceManager::RelayStartRemoteInputByType(const std::st
const uint32_t &inputTypes, sptr<IStartDInputCallback> callback)
{
std::lock_guard<std::mutex> lock(startStopMutex_);
for (auto iter : relayStaTypeCallbacks_) {
if (iter.srcId == srcId && iter.sinkId == sinkId && iter.inputTypes == inputTypes) {
DHLOGE("Repeat call.");
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
}
}
DInputClientStartTypeInfo info(srcId, sinkId, inputTypes, callback);
relayStaTypeCallbacks_.push_back(info);
@@ -752,13 +727,6 @@ int32_t DistributedInputSourceManager::RelayStopRemoteInputByType(
const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback)
{
std::lock_guard<std::mutex> lock(startStopMutex_);
for (auto iter : relayStpTypeCallbacks_) {
if (iter.srcId == srcId && iter.sinkId == sinkId && iter.inputTypes == inputTypes) {
DHLOGE("Repeat call.");
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
}
}
DInputClientStopTypeInfo info(srcId, sinkId, inputTypes, callback);
relayStpTypeCallbacks_.push_back(info);
@@ -882,16 +850,6 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &sinkI
}
// current device is source device
for (auto iter : staStringCallbacks_) {
if (iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) {
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, "dinput start use failed in already started");
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK);
DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str());
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
}
}
DInputClientStartDhidInfo info {localNetworkId, sinkId, dhIds, callback};
staStringCallbacks_.push_back(info);
DeviceMap_[sinkId] = DINPUT_SOURCE_SWITCH_OFF; // when sink device start success,set DINPUT_SOURCE_SWITCH_ON
@@ -931,15 +889,6 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &sinkId
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
}
for (auto iter : stpStringCallbacks_) {
if (iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) {
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, "dinput stop use failed in already stop");
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str());
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
}
}
DInputClientStopDhidInfo info {localNetworkId, sinkId, dhIds, callback};
stpStringCallbacks_.push_back(info);
@@ -982,15 +931,6 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &srcId
if (srcId != localNetworkId) {
return RelayStartRemoteInputByDhid(srcId, sinkId, dhIds, callback);
}
for (auto iter : staStringCallbacks_) {
if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) {
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, "Dinput start use failed in already start.");
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK);
DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str());
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
}
}
DInputClientStartDhidInfo info {srcId, sinkId, dhIds, callback};
staStringCallbacks_.push_back(info);
@@ -1035,15 +975,6 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &srcId,
if (srcId != localNetworkId) {
return RelayStopRemoteInputByDhid(srcId, sinkId, dhIds, callback);
}
for (auto iter : stpStringCallbacks_) {
if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) {
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, "Dinput stop use failed in already stop.");
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str());
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
}
}
DInputClientStopDhidInfo info {srcId, sinkId, dhIds, callback};
stpStringCallbacks_.push_back(info);
@@ -1168,13 +1099,6 @@ int32_t DistributedInputSourceManager::RelayStartRemoteInputByDhid(const std::st
const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback)
{
std::lock_guard<std::mutex> lock(startStopMutex_);
for (auto iter : relayStaDhidCallbacks_) {
if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) {
DHLOGE("Repeat call.");
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
}
}
DInputClientStartDhidInfo info{srcId, sinkId, dhIds, callback};
relayStaDhidCallbacks_.push_back(info);
@@ -1196,13 +1120,6 @@ int32_t DistributedInputSourceManager::RelayStopRemoteInputByDhid(const std::str
const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback)
{
std::lock_guard<std::mutex> lock(startStopMutex_);
for (auto iter : relayStpDhidCallbacks_) {
if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) {
DHLOGE("Repeat call.");
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
}
}
DInputClientStopDhidInfo info{srcId, sinkId, dhIds, callback};
relayStpDhidCallbacks_.push_back(info);
@@ -1715,7 +1632,7 @@ void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic
{
DHLOGI("StopDScreenListener OnMessage!");
if (topic != DHTopic::TOPIC_STOP_DSCREEN) {
DHLOGE("this topic is wrong, %d", static_cast<uint32_t>(topic));
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(topic));
return;
}
std::string sinkDevId = "";
@@ -1783,7 +1700,7 @@ void DistributedInputSourceManager::DeviceOfflineListener::OnMessage(const DHTop
{
DHLOGI("DeviceOfflineListener OnMessage!");
if (topic != DHTopic::TOPIC_DEV_OFFLINE) {
DHLOGE("this topic is wrong, %d", static_cast<uint32_t>(topic));
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(topic));
return;
}
if (message.empty()) {
@@ -95,7 +95,7 @@ void OnFile(int32_t socket, FileEvent *event)
void OnQos(int32_t socket, QoSEvent eventId, const QosTV *qos, uint32_t qosCount)
{
DHLOGI("OnQos, socket: %d, QoSEvent: %d, qosCount: %ld", socket, (int32_t)eventId, qosCount);
DHLOGI("OnQos, socket: %d, QoSEvent: %d, qosCount: %u", socket, (int32_t)eventId, qosCount);
for (uint32_t idx = 0; idx < qosCount; idx++) {
DHLOGI("QosTV: type: %d, value: %d", (int32_t)qos[idx].qos, qos[idx].value);
}
@@ -68,7 +68,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de
return;
}
size_t jsonSize = inputData.size();
DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize);
DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize);
TYPE_WHITE_LIST_VEC vecWhiteList = inputData;
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
}
@@ -69,7 +69,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de
return;
}
size_t jsonSize = inputData.size();
DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize);
DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize);
TYPE_WHITE_LIST_VEC vecWhiteList = inputData;
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
}