diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index 2f80ca239df0d56c5d43e97b06f77d67f4176e76..f6ec660ce999b270835881908a34a915e2e0dada 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -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 deviceLock(devicesMutex_); for (auto it = closingDevices_.begin(); it != closingDevices_.end();) { std::unique_ptr 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 = 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) diff --git a/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp b/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp index 6660f5242e0b49389e45bfd0b166b18fb86e99ef..480b1c6ce729b9d1011ad24a5356aacedf19d903 100644 --- a/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp +++ b/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp @@ -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 diff --git a/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp b/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp index c0bb5e4edc6a0ef10dc1bb8eda5a18a7a66d28d1..a448a3e48c58ec4e24be83211f79dbf12eea958a 100644 --- a/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp +++ b/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp @@ -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 diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 21aa8087125398a8f477f5bb5f6f6daf6efaaca9..cd962eefa5b6316296f79c019a573e8865247698 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -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; diff --git a/services/sink/transport/src/distributed_input_sink_transport.cpp b/services/sink/transport/src/distributed_input_sink_transport.cpp index 04ff9640d444d42e36d4beb564055dd84e0ee633..bedd63b185526603b35c518f1e8e7b572c3f203f 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -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) diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index 25e589e721ba9fa4975a0f26f1d189227a16d3c8..44b387b6bafc927892e0f46c5dd614187be0ac12 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -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 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); diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index 8f8912161a2a4d3a839f8c585c66cc92ce9079eb..610c426cf14a23a7b47068619e231337bb987778 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -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(); diff --git a/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp b/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp index 41aeef786e1bd349f648676874965fee8fdc531e..9b51a3d5a8608059f01aee44056db87f0deb1657 100644 --- a/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp @@ -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 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 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 DInputSourceSACliMgr::GetRemoteCliFromCache(const void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr 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 lock(remoteCliLock); @@ -118,7 +118,7 @@ void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr lock(remoteCliLock); auto item = remoteCliMap.find(devId); if (item == remoteCliMap.end()) { @@ -144,7 +144,7 @@ void DInputSourceSACliMgr::DeleteRemoteCli(const sptr 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); } diff --git a/services/state/src/dinput_sink_state.cpp b/services/state/src/dinput_sink_state.cpp index 5311a2b12d7f0dfdda3bc1de6496e90c2320eb4f..b564d8f5d2bc584ffe727fe8221e05a447da0f69 100644 --- a/services/state/src/dinput_sink_state.cpp +++ b/services/state/src/dinput_sink_state.cpp @@ -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 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; } diff --git a/services/state/src/touchpad_event_fragment_mgr.cpp b/services/state/src/touchpad_event_fragment_mgr.cpp index 64a4e09f815f7acef01ab633d28f22937d118048..a48de4c7fa9c6c1e84c0ec47eddea3fc32128d22 100644 --- a/services/state/src/touchpad_event_fragment_mgr.cpp +++ b/services/state/src/touchpad_event_fragment_mgr.cpp @@ -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 #include "dinput_log.h" +#include "dinput_utils_tool.h" namespace OHOS { namespace DistributedHardware { @@ -73,7 +74,7 @@ std::pair> 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({}); diff --git a/services/transportbase/src/distributed_input_transport_base.cpp b/services/transportbase/src/distributed_input_transport_base.cpp index 4551118fd6029ba34eb7a34a362c93a27498aa9d..24caffcd44d49766a8419abca60d8670a1505a58 100644 --- a/services/transportbase/src/distributed_input_transport_base.cpp +++ b/services/transportbase/src/distributed_input_transport_base.cpp @@ -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(localSessionName_.c_str()), .pkgName = const_cast(DINPUT_PKG_NAME.c_str()), @@ -164,7 +164,7 @@ void DistributedInputTransportBase::Release() std::unique_lock 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 dhFwkKit = DInputContext::GetInstance().GetDHFwkKit(); @@ -292,12 +292,12 @@ void DistributedInputTransportBase::StopSession(const std::string &remoteDevId) { std::unique_lock 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) { + std::string peerDevId; + peerDevId.assign(info.networkId); DHLOGI("OnSessionOpened, socket: %d, peerSocketName: %s, peerNetworkId: %s, peerPkgName: %s", - sessionId, info.name, info.networkId, info.pkgName); + sessionId, info.name, GetAnonyString(peerDevId).c_str(), info.pkgName); FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK); - std::string peerDevId; - peerDevId.assign(info.networkId); { std::unique_lock 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