!1517 动态变化属性时,如果涉及安全键盘切换,需要触发StartInput

Merge pull request !1517 from guojin31/master
This commit is contained in:
openharmony_ci 2024-10-16 02:12:33 +00:00 committed by Gitee
commit 0959ba8141
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 1 deletions

View File

@ -688,6 +688,7 @@ int32_t InputMethodController::OnConfigurationChange(Configuration info)
IMSA_HILOGD("not bound.");
return ErrorCode::ERROR_CLIENT_NOT_BOUND;
}
bool oldSecurityFlag = textConfig_.inputAttribute.GetSecurityFlag();
InputAttribute attribute;
{
std::lock_guard<std::mutex> lock(textConfigLock_);
@ -701,6 +702,15 @@ int32_t InputMethodController::OnConfigurationChange(Configuration info)
}
IMSA_HILOGI("IMC enterKeyType: %{public}d, textInputType: %{public}d.", attribute.enterKeyType,
attribute.inputPattern);
if (oldSecurityFlag != attribute.GetSecurityFlag()) {
GetTextConfig(clientInfo_.config);
sptr<IRemoteObject> agent = nullptr;
int32_t ret = StartInput(clientInfo_, agent);
if (ret != ErrorCode::NO_ERROR) {
return ret;
}
OnInputReady(agent);
}
auto agent = GetAgent();
if (agent == nullptr) {
IMSA_HILOGE("agent is nullptr!");

View File

@ -260,11 +260,11 @@ void PerUserSession::OnImeDied(const sptr<IInputMethodCore> &remote, ImeType typ
auto imeData = GetImeData(type);
auto ime = InputTypeManager::GetInstance().GetCurrentIme();
if (ime.bundleName == imeData->ime.first) {
InputTypeManager::GetInstance().Set(false);
}
if (imeData != nullptr && imeData->imeStatus == ImeStatus::EXITING) {
RemoveImeData(type, true);
NotifyImeStopFinished();
InputTypeManager::GetInstance().Set(false);
IMSA_HILOGI("%{public}d not current imeData.", type);
return;
}