mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-18 16:04:40 -04:00
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -265,7 +265,7 @@ void InputHub::DealNormalKeyEvent(Device *device, const RawEvent &event)
|
||||
if (IsCuror(device) && event.code == BTN_MOUSE &&
|
||||
!DInputSinkState::GetInstance().IsDhIdDown(event.descriptor)) {
|
||||
DHLOGI("Find mouse BTN_MOUSE UP state that not down effective at sink side, dhId: %s",
|
||||
event.descriptor.c_str());
|
||||
GetAnonyString(event.descriptor).c_str());
|
||||
DInputSinkState::GetInstance().SimulateMouseBtnMouseUpState(event.descriptor, event);
|
||||
}
|
||||
DInputSinkState::GetInstance().RemoveKeyDownState(event);
|
||||
@@ -360,8 +360,7 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize)
|
||||
std::lock_guard<std::mutex> deviceLock(devicesMutex_);
|
||||
for (auto it = closingDevices_.begin(); it != closingDevices_.end();) {
|
||||
std::unique_ptr<Device> device = std::move(*it);
|
||||
DHLOGI("Reporting device closed: id=%s, name=%s\n",
|
||||
device->path.c_str(), device->identifier.name.c_str());
|
||||
DHLOGI("Reporting device closed: id=%s, name=%s", device->path.c_str(), device->identifier.name.c_str());
|
||||
event->type = DeviceType::DEVICE_REMOVED;
|
||||
event->deviceInfo = device->identifier;
|
||||
event += 1;
|
||||
@@ -383,15 +382,14 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize)
|
||||
while (!openingDevices_.empty()) {
|
||||
std::unique_ptr<Device> device = std::move(*openingDevices_.rbegin());
|
||||
openingDevices_.pop_back();
|
||||
DHLOGI("Reporting device opened: id=%s, name=%s\n",
|
||||
device->path.c_str(), device->identifier.name.c_str());
|
||||
DHLOGI("Reporting device opened: id=%s, name=%s", device->path.c_str(), device->identifier.name.c_str());
|
||||
event->type = DeviceType::DEVICE_ADDED;
|
||||
event->deviceInfo = device->identifier;
|
||||
event += 1;
|
||||
|
||||
auto [dev_it, inserted] = devices_.insert_or_assign(device->path, std::move(device));
|
||||
if (!inserted) {
|
||||
DHLOGI("Device path %s exists, replaced. \n", device->path.c_str());
|
||||
DHLOGI("Device path %s exists, replaced.", device->path.c_str());
|
||||
}
|
||||
if (capacity == 0) {
|
||||
break;
|
||||
@@ -448,8 +446,7 @@ void InputHub::GetDeviceHandler()
|
||||
if (eventItem.events & EPOLLIN) {
|
||||
pendingINotify_ = true;
|
||||
} else {
|
||||
DHLOGI(
|
||||
"Received unexpected epoll event 0x%08x for INotify.", eventItem.events);
|
||||
DHLOGI("Received unexpected epoll event 0x%08x for INotify.", eventItem.events);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -761,7 +758,8 @@ int32_t InputHub::GetABSInfo(struct libevdev *dev, InputDevice &identifier)
|
||||
DHLOGE("The device doesn't has EV_ABS type!");
|
||||
return ERR_DH_INPUT_HUB_QUERY_INPUT_DEVICE_INFO_FAIL;
|
||||
}
|
||||
DHLOGI("The device has abs info, devName: %s, dhId: %s!", identifier.name.c_str(), identifier.descriptor.c_str());
|
||||
DHLOGI("The device has abs info, devName: %s, dhId: %s!",
|
||||
identifier.name.c_str(), GetAnonyString(identifier.descriptor).c_str());
|
||||
for (uint32_t absType = 0; absType < ABS_CNT; absType++) {
|
||||
if (!libevdev_has_event_code(dev, EV_ABS, absType)) {
|
||||
DHLOGD("The device is not support absType: %d", absType);
|
||||
@@ -1482,7 +1480,7 @@ void InputHub::SavePressedKeyState(const InputHub::Device *dev, int32_t keyCode)
|
||||
};
|
||||
DInputSinkState::GetInstance().AddKeyDownState(event);
|
||||
DHLOGI("Find Pressed key: %d, device path: %s, dhId: %s", keyCode, dev->path.c_str(),
|
||||
dev->identifier.descriptor.c_str());
|
||||
GetAnonyString(dev->identifier.descriptor).c_str());
|
||||
}
|
||||
|
||||
bool InputHub::IsLengthExceeds(const unsigned long *keyState, const unsigned long len, int keyIndex)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -58,7 +58,7 @@ void StartStopDInputsCallbackProxy::OnResultDhids(const std::string &devId, cons
|
||||
DHLOGE("OnResultDhids error, ret = %d", ret);
|
||||
return;
|
||||
}
|
||||
DHLOGE("OnResultDhids success.");
|
||||
DHLOGI("OnResultDhids success.");
|
||||
}
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -117,7 +117,7 @@ void StartStopResultCallbackProxy::OnStop(
|
||||
DHLOGE("StartStopResultCallbackProxy SendRequest errno:%d", ret);
|
||||
return;
|
||||
}
|
||||
DHLOGE("OnStop success.");
|
||||
DHLOGI("OnStop success.");
|
||||
}
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -539,7 +539,7 @@ void DistributedInputSinkManager::OnStart()
|
||||
}
|
||||
DHLOGI("dinput Manager Service started.");
|
||||
if (!InitAuto()) {
|
||||
DHLOGI("failed to init service.");
|
||||
DHLOGE("failed to init service.");
|
||||
return;
|
||||
}
|
||||
serviceRunningState_ = ServiceSinkRunningState::STATE_RUNNING;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -303,7 +303,7 @@ void DistributedInputSinkTransport::RecordEventLog(const std::string &dhId, int3
|
||||
}
|
||||
|
||||
DHLOGD("2.E2E-Test Sink softBus send, EventType: %s, Code: %d, Value: %d, dhId: %s",
|
||||
eventType.c_str(), code, value, dhId.c_str());
|
||||
eventType.c_str(), code, value, GetAnonyString(dhId).c_str());
|
||||
}
|
||||
|
||||
int32_t DistributedInputSinkTransport::SendMessage(int32_t sessionId, std::string &message)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -272,7 +272,8 @@ void DistributedInputNodeManager::SetPathForVirDev(const DhUniqueID &dhUniqueId,
|
||||
std::lock_guard<std::mutex> lock(virtualDeviceMapMutex_);
|
||||
auto iter = virtualDeviceMap_.begin();
|
||||
while (iter != virtualDeviceMap_.end()) {
|
||||
DHLOGD("Check Virtual device, deviceId %s, dhid %s.", iter->first.first.c_str(), iter->first.second.c_str());
|
||||
DHLOGD("Check Virtual device, deviceId %s, dhid %s.", GetAnonyString(iter->first.first).c_str(),
|
||||
GetAnonyString(iter->first.second).c_str());
|
||||
if (iter->first == dhUniqueId) {
|
||||
DHLOGD("Found the virtual device, set path :%s", devicePath.c_str());
|
||||
iter->second->SetPath(devicePath);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -174,7 +174,7 @@ int32_t DistributedInputSourceManager::Release()
|
||||
DHLOGI("Release devId: %s, dhId: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str());
|
||||
int32_t ret = DistributedInputInject::GetInstance().UnregisterDistributedHardware(devId, dhId);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGW("DinputSourceManager Release called, remove node fail.");
|
||||
DHLOGE("DinputSourceManager Release called, remove node fail.");
|
||||
}
|
||||
}
|
||||
DistributedInputSourceTransport::GetInstance().Release();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -65,7 +65,7 @@ sptr<IDistributedSourceInput> DInputSourceSACliMgr::GetRemoteCli(const std::stri
|
||||
DHLOGE("DInputSourceSACliMgr::GetRemoteCli deviceId is empty");
|
||||
return nullptr;
|
||||
}
|
||||
DHLOGI("DInputSourceSACliMgr::GetRemoteCli remote deviceid is %{public}s", GetAnonyString(deviceId).c_str());
|
||||
DHLOGI("DInputSourceSACliMgr::GetRemoteCli remote deviceid is %s", GetAnonyString(deviceId).c_str());
|
||||
auto remoteCli = GetRemoteCliFromCache(deviceId);
|
||||
if (remoteCli != nullptr) {
|
||||
DHLOGD("VirtualHardwareManager::GetRemoteCli get from cache!");
|
||||
@@ -80,7 +80,7 @@ sptr<IDistributedSourceInput> DInputSourceSACliMgr::GetRemoteCli(const std::stri
|
||||
|
||||
auto object = samgr->CheckSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, deviceId);
|
||||
if (object == nullptr) {
|
||||
DHLOGE("GetRemoteCli failed get remote Cli %{public}s", GetAnonyString(deviceId).c_str());
|
||||
DHLOGE("GetRemoteCli failed get remote Cli %s", GetAnonyString(deviceId).c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -101,11 +101,11 @@ sptr<IDistributedSourceInput> DInputSourceSACliMgr::GetRemoteCliFromCache(const
|
||||
void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr<IRemoteObject> object)
|
||||
{
|
||||
if (devId.empty() || (object == nullptr)) {
|
||||
DHLOGW("DInputSourceSACliMgr::AddRemoteCli param error! devId=%{public}s", GetAnonyString(devId).c_str());
|
||||
DHLOGW("DInputSourceSACliMgr::AddRemoteCli param error! devId=%s", GetAnonyString(devId).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
DHLOGI("DInputSourceSACliMgr::AddRemoteCli devId=%{public}s", GetAnonyString(devId).c_str());
|
||||
DHLOGI("DInputSourceSACliMgr::AddRemoteCli devId=%s", GetAnonyString(devId).c_str());
|
||||
object->AddDeathRecipient(remoteCliDeathRcv);
|
||||
|
||||
std::lock_guard<std::mutex> lock(remoteCliLock);
|
||||
@@ -118,7 +118,7 @@ void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr<IRemoteOb
|
||||
|
||||
void DInputSourceSACliMgr::DeleteRemoteCli(const std::string &devId)
|
||||
{
|
||||
DHLOGI("DInputSourceSACliMgr::DeleteRemoteCli devId=%{public}s", GetAnonyString(devId).c_str());
|
||||
DHLOGI("DInputSourceSACliMgr::DeleteRemoteCli devId=%s", GetAnonyString(devId).c_str());
|
||||
std::lock_guard<std::mutex> lock(remoteCliLock);
|
||||
auto item = remoteCliMap.find(devId);
|
||||
if (item == remoteCliMap.end()) {
|
||||
@@ -144,7 +144,7 @@ void DInputSourceSACliMgr::DeleteRemoteCli(const sptr<IRemoteObject> remote)
|
||||
return;
|
||||
}
|
||||
|
||||
DHLOGI("VirtualHardwareManager::DeleteRemoteCli remote.devId=%{public}s", GetAnonyString(iter->first).c_str());
|
||||
DHLOGI("VirtualHardwareManager::DeleteRemoteCli remote.devId=%s", GetAnonyString(iter->first).c_str());
|
||||
if (iter->second != nullptr) {
|
||||
iter->second->AsObject()->RemoveDeathRecipient(remoteCliDeathRcv);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -99,7 +99,7 @@ DhIdState DInputSinkState::GetStateByDhid(const std::string &dhId)
|
||||
|
||||
void DInputSinkState::SimulateMouseBtnMouseUpState(const std::string &dhId, const struct RawEvent &event)
|
||||
{
|
||||
DHLOGI("Sinmulate Mouse BTN_MOUSE UP state to source, dhId: %s", dhId.c_str());
|
||||
DHLOGI("Sinmulate Mouse BTN_MOUSE UP state to source, dhId: %s", GetAnonyString(dhId).c_str());
|
||||
int32_t scanId = GetRandomInt32();
|
||||
RawEvent mscScanEv = { event.when, EV_MSC, MSC_SCAN, scanId, dhId, event.path };
|
||||
RawEvent btnMouseUpEv = { event.when, EV_KEY, BTN_MOUSE, KEY_UP_STATE, dhId, event.path };
|
||||
@@ -136,13 +136,13 @@ void DInputSinkState::SimulateKeyDownEvents(const int32_t sessionId, const std::
|
||||
std::lock_guard<std::mutex> mapLock(keyDownStateMapMtx_);
|
||||
auto iter = keyDownStateMap_.find(dhId);
|
||||
if (iter == keyDownStateMap_.end()) {
|
||||
DHLOGI("The shared Device not has down state key, dhId: %s", dhId.c_str());
|
||||
DHLOGI("The shared Device not has down state key, dhId: %s", GetAnonyString(dhId).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &event : iter->second) {
|
||||
DHLOGI("Simulate Key event for device path: %s, dhId: %s",
|
||||
event.path.c_str(), event.descriptor.c_str());
|
||||
event.path.c_str(), GetAnonyString(event.descriptor).c_str());
|
||||
SimulateKeyDownEvent(sessionId, dhId, event);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ void DInputSinkState::SimulateTouchPadEvents(const int32_t sessionId, const std:
|
||||
return;
|
||||
}
|
||||
|
||||
DHLOGI("SimulateTouchPadEvents dhId: %s, event size: %d", dhId.c_str(), events.size());
|
||||
DHLOGI("SimulateTouchPadEvents dhId: %s, event size: %zu", GetAnonyString(dhId).c_str(), events.size());
|
||||
DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsgBatch(sessionId, events);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ void DInputSinkState::CheckAndSetLongPressedKeyOrder(struct RawEvent event)
|
||||
auto iter = keyDownStateMap_.find(event.descriptor);
|
||||
if (iter == keyDownStateMap_.end()) {
|
||||
DHLOGI("Find new pressed key, save it, node id: %s, type: %d, key code: %d, value: %d",
|
||||
event.descriptor.c_str(), event.type, event.code, event.value);
|
||||
GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value);
|
||||
keyDownStateMap_[event.descriptor].push_back(event);
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ void DInputSinkState::CheckAndSetLongPressedKeyOrder(struct RawEvent event)
|
||||
// If not find the cache key on pressing, save it
|
||||
if (evIter == keyDownStateMap_[event.descriptor].end()) {
|
||||
DHLOGI("Find new pressed key, save it, node id: %s, type: %d, key code: %d, value: %d",
|
||||
event.descriptor.c_str(), event.type, event.code, event.value);
|
||||
GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value);
|
||||
keyDownStateMap_[event.descriptor].push_back(event);
|
||||
return;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ void DInputSinkState::CheckAndSetLongPressedKeyOrder(struct RawEvent event)
|
||||
// it is already the last one, just return
|
||||
if (evIter == (keyDownStateMap_[event.descriptor].end() - 1)) {
|
||||
DHLOGI("Pressed key already last one, node id: %s, type: %d, key code: %d, value: %d",
|
||||
event.descriptor.c_str(), event.type, event.code, event.value);
|
||||
GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "dinput_log.h"
|
||||
#include "dinput_utils_tool.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
@@ -73,7 +74,7 @@ std::pair<bool, std::vector<RawEvent>> TouchPadEventFragmentMgr::DealSynEvent(co
|
||||
allEvents.insert(allEvents.end(), fragEvents.begin(), fragEvents.end());
|
||||
}
|
||||
needSim = true;
|
||||
DHLOGI("Find NOT Whole touchpad events need send back, dhId: %s", dhId.c_str());
|
||||
DHLOGI("Find NOT Whole touchpad events need send back, dhId: %s", GetAnonyString(dhId).c_str());
|
||||
}
|
||||
fragments_[dhId].clear();
|
||||
fragments_[dhId].push_back({});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -148,7 +148,7 @@ int32_t DistributedInputTransportBase::CreateServerSocket()
|
||||
std::string networkId = localNode->networkId;
|
||||
localSessionName_ = SESSION_NAME + networkId.substr(0, INTERCEPT_STRING_LENGTH);
|
||||
DHLOGI("CreateServerSocket local networkId is %s, local socketName: %s",
|
||||
networkId.c_str(), localSessionName_.c_str());
|
||||
GetAnonyString(networkId).c_str(), localSessionName_.c_str());
|
||||
SocketInfo info = {
|
||||
.name = const_cast<char*>(localSessionName_.c_str()),
|
||||
.pkgName = const_cast<char*>(DINPUT_PKG_NAME.c_str()),
|
||||
@@ -164,7 +164,7 @@ void DistributedInputTransportBase::Release()
|
||||
std::unique_lock<std::mutex> sessionLock(operationMutex_);
|
||||
auto iter = remoteDevSessionMap_.begin();
|
||||
for (; iter != remoteDevSessionMap_.end(); ++iter) {
|
||||
DHLOGI("Shutdown client socket: %d to remote dev: %s", iter->second, iter->first.c_str());
|
||||
DHLOGI("Shutdown client socket: %d to remote dev: %s", iter->second, GetAnonyString(iter->first).c_str());
|
||||
Shutdown(iter->second);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ int32_t DistributedInputTransportBase::CheckDeviceSessionState(const std::string
|
||||
if (remoteDevSessionMap_.find(remoteDevId) == remoteDevSessionMap_.end()) {
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_DEVICE_SESSION_STATE;
|
||||
}
|
||||
DHLOGI("CheckDeviceSessionState has opened %s", remoteDevId.c_str());
|
||||
DHLOGI("CheckDeviceSessionState has opened, remoteDevId: %s", GetAnonyString(remoteDevId).c_str());
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ std::string DistributedInputTransportBase::GetDevIdBySessionId(int32_t sessionId
|
||||
|
||||
int32_t DistributedInputTransportBase::CreateClientSocket(const std::string &remoteDevId)
|
||||
{
|
||||
DHLOGI("CreateClientSocket start, peerNetworkId: %s", remoteDevId.c_str());
|
||||
DHLOGI("CreateClientSocket start, peerNetworkId: %s", GetAnonyString(remoteDevId).c_str());
|
||||
std::string localSesionName = localSessionName_ + "_" + std::to_string(GetCurrentTimeUs());
|
||||
std::string peerSessionName = SESSION_NAME + remoteDevId.substr(0, INTERCEPT_STRING_LENGTH);
|
||||
SocketInfo info = {
|
||||
@@ -226,7 +226,7 @@ int32_t DistributedInputTransportBase::StartSession(const std::string &remoteDev
|
||||
{
|
||||
int32_t ret = CheckDeviceSessionState(remoteDevId);
|
||||
if (ret == DH_SUCCESS) {
|
||||
DHLOGE("Softbus session has already opened, deviceId: %s", remoteDevId.c_str());
|
||||
DHLOGE("Softbus session has already opened, deviceId: %s", GetAnonyString(remoteDevId).c_str());
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ int32_t DistributedInputTransportBase::StartSession(const std::string &remoteDev
|
||||
StartAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK);
|
||||
ret = Bind(socket, g_qosInfo, g_QosTV_Param_Index, &iSocketListener);
|
||||
if (ret < DH_SUCCESS) {
|
||||
DHLOGE("OpenSession fail, remoteDevId: %s, socket: %d", remoteDevId.c_str(), socket);
|
||||
DHLOGE("OpenSession fail, remoteDevId: %s, socket: %d", GetAnonyString(remoteDevId).c_str(), socket);
|
||||
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK);
|
||||
Shutdown(socket);
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_OPEN_SESSION_FAIL;
|
||||
@@ -247,7 +247,7 @@ int32_t DistributedInputTransportBase::StartSession(const std::string &remoteDev
|
||||
std::string peerSessionName = SESSION_NAME + remoteDevId.substr(0, INTERCEPT_STRING_LENGTH);
|
||||
HiDumper::GetInstance().CreateSessionInfo(remoteDevId, socket, localSessionName_, peerSessionName,
|
||||
SessionStatus::OPENED);
|
||||
DHLOGI("OpenSession success, remoteDevId:%s, sessionId: %d", remoteDevId.c_str(), socket);
|
||||
DHLOGI("OpenSession success, remoteDevId:%s, sessionId: %d", GetAnonyString(remoteDevId).c_str(), socket);
|
||||
sessionId_ = socket;
|
||||
|
||||
std::shared_ptr<DistributedHardwareFwkKit> dhFwkKit = DInputContext::GetInstance().GetDHFwkKit();
|
||||
@@ -292,12 +292,12 @@ void DistributedInputTransportBase::StopSession(const std::string &remoteDevId)
|
||||
{
|
||||
std::unique_lock<std::mutex> sessionLock(operationMutex_);
|
||||
if (remoteDevSessionMap_.count(remoteDevId) == 0) {
|
||||
DHLOGE("remoteDevSessionMap not find remoteDevId: %s", remoteDevId.c_str());
|
||||
DHLOGE("remoteDevSessionMap not find remoteDevId: %s", GetAnonyString(remoteDevId).c_str());
|
||||
return;
|
||||
}
|
||||
int32_t sessionId = remoteDevSessionMap_[remoteDevId];
|
||||
|
||||
DHLOGI("RemoteDevId: %s, sessionId: %d", remoteDevId.c_str(), sessionId);
|
||||
DHLOGI("RemoteDevId: %s, sessionId: %d", GetAnonyString(remoteDevId).c_str(), sessionId);
|
||||
HiDumper::GetInstance().SetSessionStatus(remoteDevId, SessionStatus::CLOSING);
|
||||
Shutdown(sessionId);
|
||||
remoteDevSessionMap_.erase(remoteDevId);
|
||||
@@ -376,12 +376,12 @@ void DistributedInputTransportBase::EraseSessionId(const std::string &remoteDevI
|
||||
|
||||
int32_t DistributedInputTransportBase::OnSessionOpened(int32_t sessionId, const PeerSocketInfo &info)
|
||||
{
|
||||
DHLOGI("OnSessionOpened, socket: %d, peerSocketName: %s, peerNetworkId: %s, peerPkgName: %s",
|
||||
sessionId, info.name, info.networkId, info.pkgName);
|
||||
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK);
|
||||
|
||||
std::string peerDevId;
|
||||
peerDevId.assign(info.networkId);
|
||||
DHLOGI("OnSessionOpened, socket: %d, peerSocketName: %s, peerNetworkId: %s, peerPkgName: %s",
|
||||
sessionId, info.name, GetAnonyString(peerDevId).c_str(), info.pkgName);
|
||||
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> sessionLock(operationMutex_);
|
||||
remoteDevSessionMap_[peerDevId] = sessionId;
|
||||
@@ -402,7 +402,7 @@ void DistributedInputTransportBase::OnSessionClosed(int32_t sessionId, ShutdownR
|
||||
DHLOGI("OnSessionClosed, socket: %d, reason: %d", sessionId, (int32_t)reason);
|
||||
std::string deviceId = GetDevIdBySessionId(sessionId);
|
||||
DHLOGI("OnSessionClosed notify session closed, sessionId: %d, peer deviceId:%s",
|
||||
sessionId, deviceId.c_str());
|
||||
sessionId, GetAnonyString(deviceId).c_str());
|
||||
RunSessionStateCallback(deviceId, SESSION_STATUS_CLOSED);
|
||||
|
||||
{
|
||||
@@ -548,7 +548,7 @@ int32_t DistributedInputTransportBase::GetSessionIdByDevId(const std::string &sr
|
||||
if (it != remoteDevSessionMap_.end()) {
|
||||
return it->second;
|
||||
}
|
||||
DHLOGE("get session id failed, srcId = %s", srcId.c_str());
|
||||
DHLOGE("get session id failed, srcId = %s", GetAnonyString(srcId).c_str());
|
||||
return ERR_DH_INPUT_SERVER_SINK_TRANSPORT_GET_SESSIONID_FAIL;
|
||||
}
|
||||
} // namespace DistributedInput
|
||||
|
||||
Reference in New Issue
Block a user