diff --git a/services/src/ime_info_inquirer.cpp b/services/src/ime_info_inquirer.cpp index 52e44fd8..92dc5e08 100644 --- a/services/src/ime_info_inquirer.cpp +++ b/services/src/ime_info_inquirer.cpp @@ -1190,18 +1190,5 @@ std::string ImeInfoInquirer::GetTargetString( IMSA_HILOGD("No match target string"); return ""; } - -std::shared_ptr ImeInfoInquirer::GetImeNativeCfg(int32_t userId, const std::string &bundleName, - const std::string &subName) -{ - auto targetImeProperty = GetImeProperty(userId, bundleName); - if (targetImeProperty == nullptr) { - IMSA_HILOGE("GetImeProperty [%{public}d, %{public}s] failed!", userId, bundleName.c_str()); - return nullptr; - } - std::string targetName = bundleName + "/" + targetImeProperty->id; - ImeNativeCfg targetIme = { targetName, bundleName, subName, targetImeProperty->id }; - return std::make_shared(targetIme); -} } // namespace MiscServices } // namespace OHOS \ No newline at end of file diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index ced8da49..8bec9c49 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -854,7 +854,7 @@ int32_t InputMethodSystemAbility::SwitchInputType(int32_t userId, const SwitchIn IMSA_HILOGE("%{public}d session is nullptr!", userId); return ErrorCode::ERROR_NULL_POINTER; } - auto targetIme = GetImeNativeCfg(userId, switchInfo.bundleName, switchInfo.subName); + auto targetIme = session->GetImeNativeCfg(userId, switchInfo.bundleName, switchInfo.subName); if (targetIme == nullptr) { IMSA_HILOGE("targetIme is nullptr!"); return ErrorCode::ERROR_NULL_POINTER; diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 7bc0a141..256bd0c5 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -1002,8 +1002,7 @@ bool PerUserSession::StartCurrentIme(bool isStopCurrentIme) std::shared_ptr imeToStart = nullptr; if (InputTypeManager::GetInstance().IsStarted()) { auto currentInputType = InputTypeManager::GetInstance().GetCurrentIme(); - imeToStart = ImeInfoInquirer::GetInstance().GetImeNativeCfg(userId_, currentInputType.bundleName, - currentInputType.subName); + imeToStart = GetImeNativeCfg(userId_, currentInputType.bundleName, currentInputType.subName); } else { auto currentIme = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId_); imeToStart = ImeInfoInquirer::GetInstance().GetImeToStart(userId_); @@ -1726,5 +1725,18 @@ bool PerUserSession::CheckPwdInputPatternConv(InputClientInfo &newClientInfo) IMSA_HILOGI("new input pattern is normal."); return exClientInfo->config.inputAttribute.GetSecurityFlag(); } + +std::shared_ptr ImeInfoInquirer::GetImeNativeCfg(int32_t userId, const std::string &bundleName, + const std::string &subName) +{ + auto targetImeProperty = GetImeProperty(userId, bundleName); + if (targetImeProperty == nullptr) { + IMSA_HILOGE("GetImeProperty [%{public}d, %{public}s] failed!", userId, bundleName.c_str()); + return nullptr; + } + std::string targetName = bundleName + "/" + targetImeProperty->id; + ImeNativeCfg targetIme = { targetName, bundleName, subName, targetImeProperty->id }; + return std::make_shared(targetIme); +} } // namespace MiscServices } // namespace OHOS \ No newline at end of file