diff --git a/services/include/input_method_system_ability_stub.h b/services/include/input_method_system_ability_stub.h index ec836b260d711814c5268b44f705f75f87645b46..3f1245a69c1d339723c091a9de9eea29a1dbb7c7 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 ec0e13aacf30ce64cc263c33ac717fd768103b45..2df19724284cb88e7902f791e926ec7b25dd8faf 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,18 +163,18 @@ 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(); } 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 +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()) {