Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>

Changes to be committed:
This commit is contained in:
ma-shaoyin 2024-10-24 17:45:50 +08:00
parent 2ac0299293
commit 9479138cc9
3 changed files with 15 additions and 16 deletions

View File

@ -1190,18 +1190,5 @@ std::string ImeInfoInquirer::GetTargetString(
IMSA_HILOGD("No match target string");
return "";
}
std::shared_ptr<ImeNativeCfg> 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<ImeNativeCfg>(targetIme);
}
} // namespace MiscServices
} // namespace OHOS

View File

@ -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;

View File

@ -1002,8 +1002,7 @@ bool PerUserSession::StartCurrentIme(bool isStopCurrentIme)
std::shared_ptr<ImeNativeCfg> 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<ImeNativeCfg> 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<ImeNativeCfg>(targetIme);
}
} // namespace MiscServices
} // namespace OHOS