From 27ea781b3be2f8461ac81ee4ac05710de7496818 Mon Sep 17 00:00:00 2001 From: hemenghao Date: Thu, 5 Jun 2025 19:03:47 +0800 Subject: [PATCH] =?UTF-8?q?kill=E6=9C=8D=E5=8A=A1=E5=90=8E=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hemenghao --- .../event_handler/include/input_device_consumer.h | 3 +++ .../proxy/event_handler/src/input_device_consumer.cpp | 11 +++++++++++ .../event_handler/src/multimodal_event_handler.cpp | 1 + 3 files changed, 15 insertions(+) diff --git a/frameworks/proxy/event_handler/include/input_device_consumer.h b/frameworks/proxy/event_handler/include/input_device_consumer.h index 3ea7765630..adfbc278a3 100644 --- a/frameworks/proxy/event_handler/include/input_device_consumer.h +++ b/frameworks/proxy/event_handler/include/input_device_consumer.h @@ -34,8 +34,11 @@ public: DISALLOW_MOVE(InputDeviceConsumer); int32_t SetInputDeviceConsumer(const std::vector& deviceNames, std::shared_ptr consumer); + void OnConnected(); std::shared_ptr deviceConsumer_ { nullptr }; + std::vector deviceNames_; + std::mutex mtx_; }; #define DEVICE_CONSUMER ::OHOS::Singleton::GetInstance() } // namespace MMI diff --git a/frameworks/proxy/event_handler/src/input_device_consumer.cpp b/frameworks/proxy/event_handler/src/input_device_consumer.cpp index 833cb96b43..b66246bcc3 100644 --- a/frameworks/proxy/event_handler/src/input_device_consumer.cpp +++ b/frameworks/proxy/event_handler/src/input_device_consumer.cpp @@ -39,7 +39,18 @@ int32_t InputDeviceConsumer::SetInputDeviceConsumer(const std::vector guard(mtx_); + if (deviceNames_.empty()) { + return; + } + MULTIMODAL_INPUT_CONNECT_MGR->SetInputDeviceConsumer(deviceNames_); +} } // namespace MMI } // namespace OHOS diff --git a/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp b/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp index d7778ff826..82b0ea4f1e 100644 --- a/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp +++ b/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp @@ -59,6 +59,7 @@ void OnConnected(const IfMMIClient& client) InputInterMgr->OnConnected(); #endif // OHOS_BUILD_ENABLE_INTERCEPTOR INPUT_ACTIVE_SUBSCRIBE_MGR.OnConnected(); + DEVICE_CONSUMER.OnConnected(); } void OnDisconnected(const IfMMIClient &client) -- Gitee