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

Changes to be committed:
This commit is contained in:
ma-shaoyin 2022-11-23 19:23:21 +08:00
parent 2541ac461d
commit 74141b6515
2 changed files with 14 additions and 5 deletions

View File

@ -183,9 +183,10 @@ private:
bool IsRestartIme(uint32_t index);
void ClearImeData(uint32_t index);
void SetCurrentClient(sptr<IInputClient> client);
sptr<IInputMethodCore> GetImsCore(int32_t index);
void SetImsCore(int32_t index, sptr<IInputMethodCore> &core);
sptr<IInputClient> GetCurrentClient();
void SetImsCore(int32_t index, sptr<IInputMethodCore> &core);
sptr<IInputMethodCore> GetImsCore(int32_t index);
bool CompareCore(int32_t index);
std::mutex propertyLock_;
SubProperty currentSubProperty;

View File

@ -665,15 +665,13 @@ namespace MiscServices {
KeyboardType *type = GetKeyboardType(index, currentKbdIndex[index]);
if (type) {
sptr<IInputClient> client = GetCurrentClient();
sptr<IInputMethodCore> core = GetImsCore(index);
sptr<IInputMethodCore> core_ = GetImsCore((1 - index));
if (client != nullptr) {
int ret = core->setKeyboardType(*type);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("setKeyboardType ret: %{public}s [%{public}d]\n", ErrorCode::ToString(ret), userId_);
}
}
if (core == core_) {
if (CompareCore(index)) {
inputMethodSetting->SetCurrentKeyboardType(type->getHashCode());
inputMethodSetting->SetCurrentSysKeyboardType(type->getHashCode());
currentKbdIndex[1 - index] = currentKbdIndex[index];
@ -1304,5 +1302,15 @@ namespace MiscServices {
std::lock_guard<std::mutex> lock(imsCoreLock_);
imsCore[index] = core;
}
bool PerUserSession::CompareCore(int32_t index)
{
sptr<IInputMethodCore> core = GetImsCore(index);
sptr<IInputMethodCore> core_ = GetImsCore((1 - index));
if (core == core_) {
return true;
}
return false;
}
} // namespace MiscServices
} // namespace OHOS