diff --git a/frameworks/proxy/event_handler/src/client_msg_handler.cpp b/frameworks/proxy/event_handler/src/client_msg_handler.cpp index fd5f473b6e52920990271ce0d0edd8b75b6c8f68..c9e97ee5c3426156b4b87f4783365cefe3c40dda 100644 --- a/frameworks/proxy/event_handler/src/client_msg_handler.cpp +++ b/frameworks/proxy/event_handler/src/client_msg_handler.cpp @@ -545,7 +545,6 @@ int32_t ClientMsgHandler::OnSubscribeInputActiveCallback(const UDSClient& client int32_t ClientMsgHandler::ReportDeviceConsumer(const UDSClient& client, NetPacket& pkt) { - MMI_HILOGD("start"); if (pkt.ChkRWError()) { MMI_HILOGE("Packet read Pointer data failed"); return RET_ERR; diff --git a/frameworks/proxy/event_handler/src/input_device_consumer.cpp b/frameworks/proxy/event_handler/src/input_device_consumer.cpp index 62acd18551783d09ff12c34d76b84874b4913552..87cf2ae098c7879815151b96e6abb703eca9ac49 100644 --- a/frameworks/proxy/event_handler/src/input_device_consumer.cpp +++ b/frameworks/proxy/event_handler/src/input_device_consumer.cpp @@ -29,7 +29,6 @@ InputDeviceConsumer::~InputDeviceConsumer() {} int32_t InputDeviceConsumer::SetInputDeviceConsumer(const std::vector& deviceNames, std::shared_ptr consumer) { - MMI_HILOGD("start"); CALL_DEBUG_ENTER; if (consumer == nullptr) { MULTIMODAL_INPUT_CONNECT_MGR->ClearInputDeviceConsumer(deviceNames); diff --git a/frameworks/proxy/event_handler/src/input_manager_impl.cpp b/frameworks/proxy/event_handler/src/input_manager_impl.cpp index 32334214b01922a47c4add7c145a6f6a1550ba3d..9072daeb9891f9b1536622a600d53ecd35a1c91c 100644 --- a/frameworks/proxy/event_handler/src/input_manager_impl.cpp +++ b/frameworks/proxy/event_handler/src/input_manager_impl.cpp @@ -2794,9 +2794,7 @@ void InputManagerImpl::UnsubscribeInputActive(int32_t subscribeId) int32_t InputManagerImpl::SetInputDeviceConsumer(const std::vector& deviceNames, std::shared_ptr consumer) { - MMI_HILOGD("start"); CALL_DEBUG_ENTER; - CHKPR(consumer, INVALID_HANDLER_ID); if (!MMIEventHdl.InitClient()) { MMI_HILOGE("Client init failed"); return RET_ERR; diff --git a/service/connect_manager/src/multimodal_input_connect_proxy.cpp b/service/connect_manager/src/multimodal_input_connect_proxy.cpp index f5a87ef12683f9beb98c5ac6b7d8e43071dcf9db..31d4f099a2723da30fe6357159c95c194397175b 100644 --- a/service/connect_manager/src/multimodal_input_connect_proxy.cpp +++ b/service/connect_manager/src/multimodal_input_connect_proxy.cpp @@ -1048,7 +1048,6 @@ int32_t MultimodalInputConnectProxy::AddInputHandler(InputHandlerType handlerTyp int32_t MultimodalInputConnectProxy::SetInputDeviceConsumer(const std::vector& deviceNames) { - MMI_HILOGD("start"); CALL_DEBUG_ENTER; MessageParcel data; if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { @@ -1073,7 +1072,6 @@ int32_t MultimodalInputConnectProxy::SetInputDeviceConsumer(const std::vector& deviceNames) { - MMI_HILOGD("start"); CALL_DEBUG_ENTER; MessageParcel data; if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { diff --git a/service/event_handler/include/event_normalize_handler.h b/service/event_handler/include/event_normalize_handler.h index d49e0193065019bc571626996a0f33c6956c0043..c9178c65cc3577ee590a92792aecea6500ec1e6c 100644 --- a/service/event_handler/include/event_normalize_handler.h +++ b/service/event_handler/include/event_normalize_handler.h @@ -80,6 +80,8 @@ private: void PointerEventSetPressedKeys(std::shared_ptr pointerEvent); bool TouchPadKnuckleDoubleClickHandle(libinput_event* event); int32_t GetToolType(libinput_event* event); + void HandleDeviceConsumerEvent(int32_t toolType, libinput_event* event, PointerEvent::PointerItem &item, + std::shared_ptr pointerEvent); private: int32_t timerId_ { -1 }; diff --git a/service/event_handler/src/event_normalize_handler.cpp b/service/event_handler/src/event_normalize_handler.cpp index c50748bc7f49a425ef1d1b4325af6390d86c388c..96dee711f5f9e6c1fde112ee6739893b5ddc769f 100644 --- a/service/event_handler/src/event_normalize_handler.cpp +++ b/service/event_handler/src/event_normalize_handler.cpp @@ -730,20 +730,10 @@ int32_t EventNormalizeHandler::HandleTouchEvent(libinput_event* event, int64_t f } else { auto toolType = GetToolType(event); if (toolType == PointerEvent::TOOL_TYPE_THP_FEATURE) { - auto touch = libinput_event_get_touch_event(event); - CHKPR(touch, ERROR_NULL_POINTER); - auto orientation = libinput_event_touch_get_orientation(touch); - item.SetOrientation(orientation); - item.SetToolType(toolType); - pointerEvent->UpdatePointerItem(pointerEvent->GetPointerId(), item); - CHKPF(event); - auto device = libinput_event_get_device(event); - CHKPF(device); - std::string name = libinput_device_get_name(device); - DEVICEHANDLER->HandleDeviceConsumerEvent(name, pointerEvent); - return RET_OK; + HandleDeviceConsumerEvent(toolType, event, item, pointerEvent); + } else { + nextHandler_->HandleTouchEvent(pointerEvent); } - nextHandler_->HandleTouchEvent(pointerEvent); } } #ifdef OHOS_BUILD_ENABLE_VKEYBOARD @@ -1183,5 +1173,21 @@ int32_t EventNormalizeHandler::GetToolType(libinput_event* event) } return libinput_event_touch_get_tool_type(touch); } + +void EventNormalizeHandler::HandleDeviceConsumerEvent(int32_t toolType, libinput_event* event, + PointerEvent::PointerItem &item, std::shared_ptr pointerEvent) +{ + auto touch = libinput_event_get_touch_event(event); + CHKPV(touch); + auto orientation = libinput_event_touch_get_orientation(touch); + item.SetOrientation(orientation); + item.SetToolType(toolType); + pointerEvent->UpdatePointerItem(pointerEvent->GetPointerId(), item); + CHKPV(event); + auto device = libinput_event_get_device(event); + CHKPV(device); + std::string name = libinput_device_get_name(device); + DEVICEHANDLER->HandleDeviceConsumerEvent(name, pointerEvent); +} } // namespace MMI } // namespace OHOS diff --git a/service/module_loader/src/mmi_service.cpp b/service/module_loader/src/mmi_service.cpp index ca3408568a377ea078259e20cfa31aff8cd5f313..31fd239d965a5594f805d8252b13a79039ffb999 100644 --- a/service/module_loader/src/mmi_service.cpp +++ b/service/module_loader/src/mmi_service.cpp @@ -3803,7 +3803,6 @@ int32_t MMIService::UnsubscribeInputActive(int32_t subscribeId) int32_t MMIService::SetInputDeviceConsumer(const std::vector& deviceNames) { - MMI_HILOGD("start"); CALL_INFO_TRACE; int32_t pid = GetCallingPid(); auto sess = GetSessionByPid(pid); @@ -3822,7 +3821,6 @@ int32_t MMIService::SetInputDeviceConsumer(const std::vector& devic int32_t MMIService::ClearInputDeviceConsumer(const std::vector& deviceNames) { - MMI_HILOGD("start"); CALL_INFO_TRACE; int32_t pid = GetCallingPid(); auto sess = GetSessionByPid(pid); diff --git a/service/touch_event_normalize/src/input_device_consumer_handler.cpp b/service/touch_event_normalize/src/input_device_consumer_handler.cpp index b9337b1fa1535380470dbf281d809d8891ed28a8..1d5e4e5d402efec78a935f8f45a0ad516e5b43ab 100644 --- a/service/touch_event_normalize/src/input_device_consumer_handler.cpp +++ b/service/touch_event_normalize/src/input_device_consumer_handler.cpp @@ -31,7 +31,6 @@ namespace MMI { int32_t InputDeviceConsumerHandler::SetDeviceConsumerHandler(const std::vector& deviceNames, SessionPtr sess) { - MMI_HILOGD("start"); CALL_INFO_TRACE; CHKPR(sess, ERROR_NULL_POINTER); for (auto& name : deviceNames) { @@ -55,7 +54,6 @@ int32_t InputDeviceConsumerHandler::ClearDeviceConsumerHandler(const std::vector void InputDeviceConsumerHandler::DeviceHandler::HandleEvent(std::string name, std::shared_ptr pointerEvent) { - MMI_HILOGD("start"); CHKPV(pointerEvent); auto it = deviceHandler_.find(name); if (it == deviceHandler_.end()) { @@ -81,9 +79,10 @@ void InputDeviceConsumerHandler::DeviceHandler::HandleEvent(std::string name, return; } for (const auto& [deviceName, handlers] : deviceHandler_) { - MMI_HILOGD("HandleEvent, deviceName:%{public}s", deviceName.c_str()); - for (const auto& handler : handlers) { - handler.SendToClient(pointerEvent, pkt); + if (deviceName == name) { + for (const auto& handler : handlers) { + handler.SendToClient(pointerEvent, pkt); + } } } } @@ -91,7 +90,6 @@ void InputDeviceConsumerHandler::DeviceHandler::HandleEvent(std::string name, int32_t InputDeviceConsumerHandler::DeviceHandler::RemoveDeviceHandler(const std::vector& deviceNames, SessionPtr sess) { - MMI_HILOGD("start"); for (const auto& name : deviceNames) { auto it = deviceHandler_.find(name); if (it != deviceHandler_.end()) {