From 316d4d6b0ac18a13d4b8c0dd5469ebc429d21676 Mon Sep 17 00:00:00 2001 From: caochunlei Date: Tue, 25 Jan 2022 12:24:24 +0000 Subject: [PATCH 1/2] 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 ec0e13aac..e522c02bd 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 From 4d7780b89f431b0df2c9daf7972d15c3e21303c1 Mon Sep 17 00:00:00 2001 From: caochunlei Date: Tue, 25 Jan 2022 13:08:14 +0000 Subject: [PATCH 2/2] 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 e522c02bd..2df197242 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -172,9 +172,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(); @@ -182,7 +182,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