diff --git a/frameworks/proxy/event_handler/include/input_device_consumer.h b/frameworks/proxy/event_handler/include/input_device_consumer.h index 3ea77656304c80fa3f0fe3caa6056553423db1c7..adfbc278a3904be358c87f4a4c7daa92dbbd713b 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 833cb96b43af0e814f82900f973a074a14ee235d..b66246bcc3e3e19bc0e2d0d95d824622dc823700 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 d7778ff826231ce1d4e3647397fc58b6d03f54c6..82b0ea4f1efa6d1a627138cd851ba383788647be 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)