From a073679196a096a6ffe1cce907e45989f2eb7888 Mon Sep 17 00:00:00 2001 From: caochunlei Date: Tue, 25 Jan 2022 13:08:14 +0000 Subject: [PATCH 1/2] fixed 4d7780b from https://gitee.com/ccllee/miscservices_inputmethod/pulls/44 caochunlei1@huawei.com Signed-off-by: caochunlei --- services/src/input_method_system_ability.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index ec0e13aac..8ce928e56 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -171,9 +171,9 @@ namespace MiscServices { } void InputMethodSystemAbility::StartInputService() { - PerUserSession *session = GetUserSession(0); + PerUserSession *session = GetUserSession(MAIN_USER_ID); - std::map::const_iterator it = msgHandlers.find(0); + std::map::const_iterator it = msgHandlers.find(MAIN_USER_ID); if (it == msgHandlers.end()) { IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler"); MessageHandler *handler = new MessageHandler(); @@ -181,7 +181,7 @@ namespace MiscServices { IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is nullptr"); } session->CreateWorkThread(*handler); - msgHandlers.insert(std::pair(0, handler)); + msgHandlers.insert(std::pair(MAIN_USER_ID, handler)); } if (!session->StartInputService()) { -- Gitee From b797fdb92e07b0e4fa4fa4bafd4b20237b97f6b4 Mon Sep 17 00:00:00 2001 From: caochunlei Date: Tue, 25 Jan 2022 12:24:24 +0000 Subject: [PATCH 2/2] fixed 316d4d6 from https://gitee.com/ccllee/miscservices_inputmethod/pulls/44 caochunlei1@huawei.com Signed-off-by: caochunlei --- services/include/input_method_system_ability_stub.h | 2 +- services/src/input_method_system_ability.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/include/input_method_system_ability_stub.h b/services/include/input_method_system_ability_stub.h index ec836b260..3f1245a69 100644 --- a/services/include/input_method_system_ability_stub.h +++ b/services/include/input_method_system_ability_stub.h @@ -37,7 +37,7 @@ namespace MiscServices { void setInputMethodCoreFromHap(MessageParcel& data); protected: int32_t getUserId(int32_t uid); - int USER_ID_CHANGE_VALUE = 1000000; + int USER_ID_CHANGE_VALUE = 200000; // user range }; } } diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 8ce928e56..2df197242 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -26,6 +26,7 @@ namespace MiscServices { using namespace MessageID; REGISTER_SYSTEM_ABILITY_BY_ID(InputMethodSystemAbility, INPUT_METHOD_SYSTEM_ABILITY_ID, true); const std::int32_t INIT_INTERVAL = 10000L; + const std::int32_t MAIN_USER_ID = 100; std::mutex InputMethodSystemAbility::instanceLock_; sptr InputMethodSystemAbility::instance_; @@ -162,10 +163,10 @@ namespace MiscServices { workThreadHandler = std::thread([this] { WorkThread(); }); - PerUserSetting *setting = new PerUserSetting(0); - PerUserSession *session = new PerUserSession(0); - userSettings.insert(std::pair(0, setting)); - userSessions.insert(std::pair(0, session)); + PerUserSetting *setting = new PerUserSetting(MAIN_USER_ID); + PerUserSession *session = new PerUserSession(MAIN_USER_ID); + userSettings.insert(std::pair(MAIN_USER_ID, setting)); + userSessions.insert(std::pair(MAIN_USER_ID, session)); setting->Initialize(); } -- Gitee