From d262ecff3cb2657583dda39abd5aafeebe2df99e Mon Sep 17 00:00:00 2001 From: ma-shaoyin Date: Wed, 9 Nov 2022 15:31:46 +0800 Subject: [PATCH] Signed-off-by: ma-shaoyin Changes to be committed: --- etc/para/src/para_handle.cpp | 9 +++++---- services/src/input_method_system_ability.cpp | 4 +--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/etc/para/src/para_handle.cpp b/etc/para/src/para_handle.cpp index 44922058..3ea1dd93 100644 --- a/etc/para/src/para_handle.cpp +++ b/etc/para/src/para_handle.cpp @@ -19,7 +19,8 @@ namespace OHOS { namespace MiscServices { const char *ParaHandle::DEFAULT_IME_KEY = "persist.sys.default_ime"; - const char *ParaHandle::DEFAULT_IME_NAME = "com.example.kikakeyboard/ServiceExtAbility"; + const std::string ParaHandle::CURRENT_PACKAGE_NAME = "com.example.kikakeyboard"; + const std::string ParaHandle::CURRRET_ABILITY_NAME = "ServiceExtAbility"; bool ParaHandle::SetDefaultIme(int32_t userId, const std::string &imeName) { if (userId != main_userId) { @@ -41,9 +42,9 @@ namespace OHOS { if (code > 0) { return value; } - - SetDefaultIme(userId, DEFAULT_IME_NAME); - return DEFAULT_IME_NAME; + std::string defaultName = CURRENT_PACKAGE_NAME + "/" + CURRRET_ABILITY_NAME; + SetDefaultIme(userId, defaultName); + return defaultName; } } // namespace MiscServices } // namespace OHOS diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index be6785bf..a8fdc5f9 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -1198,9 +1198,7 @@ namespace MiscServices { std::string::size_type pos = defaultIme.find("/"); std::string currentIme = defaultIme.substr(0, pos); if (packageName == currentIme) { - std::string packageName = "com.example.kikakeyboard"; - std::string abilityName = "ServiceExtAbility"; - int32_t ret = OnSwitchInputMethod(packageName, abilityName); + int32_t ret = OnSwitchInputMethod(ParaHandle::CURRENT_PACKAGE_NAME, ParaHandle::CURRRET_ABILITY_NAME); IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved ret = %{public}d", ret); } return 0;