From 13ae8a5001ba3ffef92bb3ad233373dd8aae40c7 Mon Sep 17 00:00:00 2001 From: mayunteng_1 Date: Sun, 28 Apr 2024 10:58:53 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=AA=97=E5=8F=A3=E5=90=8C=E6=AD=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mayunteng_1 Change-Id: I55a9e821ac216863795b1bbe8ec7d5037a35d428 --- .../include/input_manager_impl.h | 1 + .../event_handler/src/input_manager_impl.cpp | 17 +++++++++++++- frameworks/proxy/events/src/input_manager.cpp | 5 ++++ .../innerkits/proxy/include/input_manager.h | 2 ++ .../innerkits/proxy/include/window_info.h | 2 ++ .../include/i_multimodal_input_connect.h | 1 + .../multimodal_input_connect_manager.h | 1 + .../include/multimodal_input_connect_proxy.h | 1 + .../include/multimodal_input_connect_stub.h | 1 + .../multimodalinput_ipc_interface_code.h | 1 + .../src/multimodal_input_connect_manager.cpp | 6 +++++ .../src/multimodal_input_connect_proxy.cpp | 23 +++++++++++++++++++ .../src/multimodal_input_connect_stub.cpp | 17 ++++++++++++++ .../message_handle/src/server_msg_handler.cpp | 3 ++- service/module_loader/include/mmi_service.h | 1 + service/module_loader/src/mmi_service.cpp | 11 +++++++++ .../include/input_windows_manager.h | 2 ++ .../src/input_windows_manager.cpp | 13 +++++++++-- 18 files changed, 104 insertions(+), 4 deletions(-) diff --git a/frameworks/proxy/event_handler/include/input_manager_impl.h b/frameworks/proxy/event_handler/include/input_manager_impl.h index f91c56a31e..b5d4c75e36 100644 --- a/frameworks/proxy/event_handler/include/input_manager_impl.h +++ b/frameworks/proxy/event_handler/include/input_manager_impl.h @@ -198,6 +198,7 @@ public: int32_t GetInfraredFrequencies(std::vector& requencys); int32_t TransmitInfrared(int64_t number, std::vector& pattern); int32_t SetPixelMapData(int32_t infoId, void* pixelMap); + int32_t SetCurrentUser(int32_t userId); private: int32_t PackWindowInfo(NetPacket &pkt); diff --git a/frameworks/proxy/event_handler/src/input_manager_impl.cpp b/frameworks/proxy/event_handler/src/input_manager_impl.cpp index ac941de676..6eb87553f7 100644 --- a/frameworks/proxy/event_handler/src/input_manager_impl.cpp +++ b/frameworks/proxy/event_handler/src/input_manager_impl.cpp @@ -488,7 +488,8 @@ void InputManagerImpl::OnPointerEvent(std::shared_ptr pointerEvent int32_t InputManagerImpl::PackDisplayData(NetPacket &pkt) { CALL_DEBUG_ENTER; - pkt << displayGroupInfo_.width << displayGroupInfo_.height << displayGroupInfo_.focusWindowId; + pkt << displayGroupInfo_.width << displayGroupInfo_.height + << displayGroupInfo_.focusWindowId << displayGroupInfo_.currentUserId; if (pkt.ChkRWError()) { MMI_HILOGE("Packet write logical data failed"); return RET_ERR; @@ -2061,5 +2062,19 @@ int32_t InputManagerImpl::SetPixelMapData(int32_t infoId, void* pixelMap) } return ret; } + +int32_t InputManagerImpl::SetCurrentUser(int32_t userId) +{ + CALL_DEBUG_ENTER; + if (userId < 0) { + MMI_HILOGE("Invalid userId"); + return RET_ERR; + } + int32_t ret = MULTIMODAL_INPUT_CONNECT_MGR->SetCurrentUser(userId); + if (ret != RET_OK) { + MMI_HILOGE("Failed to set userId, ret:%{public}d", ret); + } + return ret; +} } // namespace MMI } // namespace OHOS diff --git a/frameworks/proxy/events/src/input_manager.cpp b/frameworks/proxy/events/src/input_manager.cpp index 4419eac543..3bb4527c10 100644 --- a/frameworks/proxy/events/src/input_manager.cpp +++ b/frameworks/proxy/events/src/input_manager.cpp @@ -541,5 +541,10 @@ int32_t InputManager::TransmitInfrared(int64_t number, std::vector& pat { return InputMgrImpl.TransmitInfrared(number, pattern); } + +int32_t InputManager::SetCurrentUser(int32_t userId) +{ + return InputMgrImpl.SetCurrentUser(userId); +} } // namespace MMI } // namespace OHOS diff --git a/interfaces/native/innerkits/proxy/include/input_manager.h b/interfaces/native/innerkits/proxy/include/input_manager.h index 37927a7ca8..e405a8c02d 100644 --- a/interfaces/native/innerkits/proxy/include/input_manager.h +++ b/interfaces/native/innerkits/proxy/include/input_manager.h @@ -842,6 +842,8 @@ public: */ int32_t TransmitInfrared(int64_t number, std::vector& pattern); + int32_t SetCurrentUser(int32_t userId); + private: InputManager() = default; DISALLOW_COPY_AND_MOVE(InputManager); diff --git a/interfaces/native/innerkits/proxy/include/window_info.h b/interfaces/native/innerkits/proxy/include/window_info.h index 2348d62530..207baf1191 100644 --- a/interfaces/native/innerkits/proxy/include/window_info.h +++ b/interfaces/native/innerkits/proxy/include/window_info.h @@ -418,6 +418,8 @@ struct DisplayGroupInfo { */ int32_t focusWindowId; + int32_t currentUserId { -1 }; + /** * List of window information of the logical display arranged in Z order, with the top window at the top * diff --git a/service/connect_manager/include/i_multimodal_input_connect.h b/service/connect_manager/include/i_multimodal_input_connect.h index 5490e2b7fd..d85037bacb 100644 --- a/service/connect_manager/include/i_multimodal_input_connect.h +++ b/service/connect_manager/include/i_multimodal_input_connect.h @@ -134,6 +134,7 @@ public: virtual int32_t GetInfraredFrequencies(std::vector& requencys) = 0; virtual int32_t TransmitInfrared(int64_t number, std::vector& pattern) = 0; virtual int32_t SetPixelMapData(int32_t infoId, void* pixelMap) = 0; + virtual int32_t SetCurrentUser(int32_t userId) = 0; }; } // namespace MMI } // namespace OHOS diff --git a/service/connect_manager/include/multimodal_input_connect_manager.h b/service/connect_manager/include/multimodal_input_connect_manager.h index 4d61d646c7..48526ca9a7 100644 --- a/service/connect_manager/include/multimodal_input_connect_manager.h +++ b/service/connect_manager/include/multimodal_input_connect_manager.h @@ -128,6 +128,7 @@ public: void AddServiceWatcher(std::shared_ptr watcher); void RemoveServiceWatcher(std::shared_ptr watcher); int32_t SetPixelMapData(int32_t infoId, void* pixelMap); + int32_t SetCurrentUser(int32_t userId); private: MultimodalInputConnectManager() = default; diff --git a/service/connect_manager/include/multimodal_input_connect_proxy.h b/service/connect_manager/include/multimodal_input_connect_proxy.h index 9ba3c88668..77d5e76d1f 100644 --- a/service/connect_manager/include/multimodal_input_connect_proxy.h +++ b/service/connect_manager/include/multimodal_input_connect_proxy.h @@ -122,6 +122,7 @@ public: int32_t GetInfraredFrequencies(std::vector& requencys) override; int32_t TransmitInfrared(int64_t number, std::vector& pattern) override; int32_t SetPixelMapData(int32_t infoId, void* pixelMap) override; + int32_t SetCurrentUser(int32_t userId) override; private: static inline BrokerDelegator delegator_; diff --git a/service/connect_manager/include/multimodal_input_connect_stub.h b/service/connect_manager/include/multimodal_input_connect_stub.h index 8aaa1d7c41..1962c3d0d9 100644 --- a/service/connect_manager/include/multimodal_input_connect_stub.h +++ b/service/connect_manager/include/multimodal_input_connect_stub.h @@ -124,6 +124,7 @@ protected: int32_t StubGetInfraredFrequencies(MessageParcel& data, MessageParcel& reply); int32_t StubTransmitInfrared(MessageParcel& data, MessageParcel& reply); int32_t StubSetPixelMapData(MessageParcel& data, MessageParcel& reply); + int32_t StubSetCurrentUser(MessageParcel& data, MessageParcel& reply); private: int32_t VerifyTouchPadSetting(void); }; diff --git a/service/connect_manager/include/multimodalinput_ipc_interface_code.h b/service/connect_manager/include/multimodalinput_ipc_interface_code.h index 830cf41e89..60427242b3 100644 --- a/service/connect_manager/include/multimodalinput_ipc_interface_code.h +++ b/service/connect_manager/include/multimodalinput_ipc_interface_code.h @@ -106,6 +106,7 @@ enum class MultimodalinputConnectInterfaceCode { NATIVE_INFRARED_FREQUENCY = 84, NATIVE_CANCEL_TRANSMIT = 85, SET_PIXEL_MAP_DATA = 86, + SET_CURRENT_USERID = 87, }; enum class MultimodalinputEventObserverCode { diff --git a/service/connect_manager/src/multimodal_input_connect_manager.cpp b/service/connect_manager/src/multimodal_input_connect_manager.cpp index dbc6468463..51cd959ee9 100644 --- a/service/connect_manager/src/multimodal_input_connect_manager.cpp +++ b/service/connect_manager/src/multimodal_input_connect_manager.cpp @@ -718,5 +718,11 @@ int32_t MultimodalInputConnectManager::SetPixelMapData(int32_t infoId, void* pix CHKPR(multimodalInputConnectService_, RET_ERR); return multimodalInputConnectService_->SetPixelMapData(infoId, pixelMap); } + +int32_t MultimodalInputConnectManager::SetCurrentUser(int32_t userId) +{ + CHKPR(multimodalInputConnectService_, RET_ERR); + return multimodalInputConnectService_->SetCurrentUser(userId); +} } // namespace MMI } // namespace OHOS diff --git a/service/connect_manager/src/multimodal_input_connect_proxy.cpp b/service/connect_manager/src/multimodal_input_connect_proxy.cpp index ffd9e1d661..209605003b 100644 --- a/service/connect_manager/src/multimodal_input_connect_proxy.cpp +++ b/service/connect_manager/src/multimodal_input_connect_proxy.cpp @@ -2003,5 +2003,28 @@ int32_t MultimodalInputConnectProxy::SetPixelMapData(int32_t infoId, void* pixel } return ret; } + + +int32_t MultimodalInputConnectProxy::SetCurrentUser(int32_t userId) +{ + CALL_DEBUG_ENTER; + MessageParcel data; + if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { + MMI_HILOGE("Failed to write descriptor"); + return ERR_INVALID_VALUE; + } + WRITEINT32(data, userId, ERR_INVALID_VALUE); + MessageParcel reply; + MessageOption option; + sptr remote = Remote(); + CHKPR(remote, RET_ERR); + int32_t ret = remote->SendRequest( + static_cast(MultimodalinputConnectInterfaceCode::SET_CURRENT_USERID), data, reply, option); + if (ret != RET_OK) { + MMI_HILOGE("Send request fail, ret:%{public}d", ret); + return ret; + } + return RET_OK; +} } // namespace MMI } // namespace OHOS diff --git a/service/connect_manager/src/multimodal_input_connect_stub.cpp b/service/connect_manager/src/multimodal_input_connect_stub.cpp index b7516e8b31..c2fbd32470 100644 --- a/service/connect_manager/src/multimodal_input_connect_stub.cpp +++ b/service/connect_manager/src/multimodal_input_connect_stub.cpp @@ -309,6 +309,9 @@ int32_t MultimodalInputConnectStub::OnRemoteRequest(uint32_t code, MessageParcel case static_cast(MultimodalinputConnectInterfaceCode::SET_PIXEL_MAP_DATA): return StubSetPixelMapData(data, reply); break; + case static_cast(MultimodalinputConnectInterfaceCode::SET_CURRENT_USERID): + return StubSetCurrentUser(data, reply); + break; default: { MMI_HILOGE("Unknown code:%{public}u, go switch default", code); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); @@ -2170,5 +2173,19 @@ int32_t MultimodalInputConnectStub::StubSetPixelMapData(MessageParcel& data, Mes } return ret; } + +int32_t MultimodalInputConnectStub::StubSetCurrentUser(MessageParcel& data, MessageParcel& reply) +{ + CALL_DEBUG_ENTER; + int64_t userId = 0; + READINT32(data, userId, IPC_PROXY_DEAD_OBJECT_ERR); + int32_t ret = SetCurrentUser(userId); + if (ret != RET_OK) { + MMI_HILOGE("Failed to call SetCurrentUser ret:%{public}d", ret); + return ret; + } + WRITEINT32(reply, ret); + return RET_OK; +} } // namespace MMI } // namespace OHOS diff --git a/service/message_handle/src/server_msg_handler.cpp b/service/message_handle/src/server_msg_handler.cpp index ab3e89cdac..3f5b79c512 100644 --- a/service/message_handle/src/server_msg_handler.cpp +++ b/service/message_handle/src/server_msg_handler.cpp @@ -266,7 +266,8 @@ int32_t ServerMsgHandler::OnDisplayInfo(SessionPtr sess, NetPacket &pkt) CALL_DEBUG_ENTER; CHKPR(sess, ERROR_NULL_POINTER); DisplayGroupInfo displayGroupInfo; - pkt >> displayGroupInfo.width >> displayGroupInfo.height >> displayGroupInfo.focusWindowId; + pkt >> displayGroupInfo.width >> displayGroupInfo.height >> + displayGroupInfo.focusWindowId >> displayGroupInfo.currentUserId; uint32_t num = 0; pkt >> num; if (pkt.ChkRWError()) { diff --git a/service/module_loader/include/mmi_service.h b/service/module_loader/include/mmi_service.h index de9fa46836..51f5b3a607 100644 --- a/service/module_loader/include/mmi_service.h +++ b/service/module_loader/include/mmi_service.h @@ -141,6 +141,7 @@ public: int32_t OnGetInfraredFrequencies(std::vector& requencys); int32_t OnTransmitInfrared(int64_t number, std::vector& pattern); int32_t SetPixelMapData(int32_t infoId, void* pixelMap) override; + int32_t SetCurrentUser(int32_t userId) override; #ifdef OHOS_BUILD_ENABLE_ANCO void InitAncoUds(); diff --git a/service/module_loader/src/mmi_service.cpp b/service/module_loader/src/mmi_service.cpp index 199ab4a6a9..36dc7dedde 100644 --- a/service/module_loader/src/mmi_service.cpp +++ b/service/module_loader/src/mmi_service.cpp @@ -2104,5 +2104,16 @@ int32_t MMIService::SetPixelMapData(int32_t infoId, void* pixelMap) } return RET_OK; } + +int32_t MMIService::SetCurrentUser(int32_t userId) +{ + CALL_DEBUG_ENTER; + int32_t ret = delegateTasks_.PostSyncTask(std::bind(&InputWindowsManager::SetCurrentUser, WinMgr, userId)); + if (ret != RET_OK) { + MMI_HILOGE("Failed to set current user, ret:%{public}d", ret); + return RET_ERR; + } + return RET_OK; +} } // namespace MMI } // namespace OHOS diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index a9e17eb338..84753b2154 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -154,6 +154,7 @@ public: void AddTargetWindowIds(int32_t pointerItemId, int32_t windowId); void ClearTargetWindowIds(); bool IsTransparentWin(void* pixelMap, int32_t logicalX, int32_t logicalY); + int32_t SetCurrentUser(int32_t userId); private: int32_t GetDisplayId(std::shared_ptr inputEvent) const; @@ -274,6 +275,7 @@ private: DisplayMode displayMode_ { DisplayMode::UNKNOWN }; bool mouseFlag_ {false}; std::map> targetWindowIds_; + int32_t currentUserId_ { -1 }; }; #define WinMgr ::OHOS::DelayedSingleton::GetInstance() diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 0318cdf6e9..b15fee3876 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -518,8 +518,10 @@ void InputWindowsManager::UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) displayGroupInfoTmp_ = displayGroupInfo; if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() || action == WINDOW_UPDATE_ACTION::ADD_END) { - displayGroupInfo_ = displayGroupInfoTmp_; - UpdateWindowsInfoPerDisplay(displayGroupInfo); + if (currentUserId_ != -1 && currentUserId_ == displayGroupInfoTmp_.currentUserId) { + displayGroupInfo_ = displayGroupInfoTmp_; + UpdateWindowsInfoPerDisplay(displayGroupInfo); + } } PrintDisplayInfo(); UpdateDisplayIdAndName(); @@ -2849,5 +2851,12 @@ bool InputWindowsManager::IsTransparentWin(void* pixelMap, int32_t logicalX, int dst, pixelMapPtr->GetByteCount(), pixelMapPtr->GetWidth(), pixelMapPtr->GetHeight()); return dst == RET_OK; } + +int32_t InputWindowsManager::SetCurrentUser(int32_t userId) +{ + CALL_DEBUG_ENTER; + currentUserId_ = userId; + return RET_OK; +} } // namespace MMI } // namespace OHOS -- Gitee From bda4e787a10a1a2ad61157a88ba6e0e48fefc9ec Mon Sep 17 00:00:00 2001 From: mayunteng_1 Date: Sun, 28 Apr 2024 12:11:09 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9userid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mayunteng_1 Change-Id: I022975c3614ba54454e35b915568e5fa0ee1c0e2 --- service/connect_manager/src/multimodal_input_connect_stub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/connect_manager/src/multimodal_input_connect_stub.cpp b/service/connect_manager/src/multimodal_input_connect_stub.cpp index c2fbd32470..80b0c6db19 100644 --- a/service/connect_manager/src/multimodal_input_connect_stub.cpp +++ b/service/connect_manager/src/multimodal_input_connect_stub.cpp @@ -2177,7 +2177,7 @@ int32_t MultimodalInputConnectStub::StubSetPixelMapData(MessageParcel& data, Mes int32_t MultimodalInputConnectStub::StubSetCurrentUser(MessageParcel& data, MessageParcel& reply) { CALL_DEBUG_ENTER; - int64_t userId = 0; + int32_t userId = 0; READINT32(data, userId, IPC_PROXY_DEAD_OBJECT_ERR); int32_t ret = SetCurrentUser(userId); if (ret != RET_OK) { -- Gitee From 62c28c88e82499ddbf9e9f6148ca046e768d38d4 Mon Sep 17 00:00:00 2001 From: mayunteng_1 Date: Sun, 28 Apr 2024 12:47:55 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9userid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mayunteng_1 Change-Id: Ic3528fca72932830d5086169e63c381dd2078273 --- service/window_manager/src/input_windows_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index b15fee3876..191731d119 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -518,7 +518,7 @@ void InputWindowsManager::UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) displayGroupInfoTmp_ = displayGroupInfo; if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() || action == WINDOW_UPDATE_ACTION::ADD_END) { - if (currentUserId_ != -1 && currentUserId_ == displayGroupInfoTmp_.currentUserId) { + if ((currentUserId_ < 0) || (currentUserId_ == displayGroupInfoTmp_.currentUserId)) { displayGroupInfo_ = displayGroupInfoTmp_; UpdateWindowsInfoPerDisplay(displayGroupInfo); } -- Gitee