Merge branch 'master' of gitee.com:openharmony/inputmethod_imf into master

Signed-off-by: wTong888 <wangtong94@huawei.com>
This commit is contained in:
wTong888 2024-07-09 13:58:59 +00:00 committed by wTong6
commit 0937e3353e
7 changed files with 24 additions and 14 deletions

View File

@ -35,7 +35,8 @@ ErrCode InputMethodExtensionContext::StartAbility(const AAFwk::Want &want) const
return err;
}
ErrCode InputMethodExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const
ErrCode InputMethodExtensionContext::StartAbility(const AAFwk::Want &want,
const AAFwk::StartOptions &startOptions) const
{
IMSA_HILOGD("%{public}s start.", __func__);
ErrCode err =

View File

@ -901,7 +901,8 @@ bool InputMethodPanel::IsSizeValid(PanelFlag panelFlag, uint32_t width, uint32_t
return false;
}
if (static_cast<int32_t>(width) > displayWidth) {
IMSA_HILOGE("width is invalid, defaultDisplay width: %{public}d, target width: %{public}u!", displayWidth, width);
IMSA_HILOGE("width is invalid, defaultDisplay width: %{public}d, target width: %{public}u!", displayWidth,
width);
return false;
}
return true;

View File

@ -204,7 +204,9 @@ int32_t InputMethodSystemAbilityProxy::SwitchInputMethod(const std::string &name
int32_t InputMethodSystemAbilityProxy::PanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info)
{
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::PANEL_STATUS_CHANGE),
[status, &info](MessageParcel &data) { return ITypesUtil::Marshal(data, static_cast<uint32_t>(status), info); });
[status, &info](MessageParcel &data) {
return ITypesUtil::Marshal(data, static_cast<uint32_t>(status), info);
});
}
int32_t InputMethodSystemAbilityProxy::UpdateListenEventFlag(InputClientInfo &clientInfo, uint32_t eventFlag)

View File

@ -67,7 +67,8 @@ void EnableImeDataParser::OnUserChanged(const int32_t targetUserId)
IMSA_HILOGD("current userId: %{public}d, switch to: %{public}d", currentUserId_, targetUserId);
currentUserId_ = targetUserId;
if (GetEnableData(ENABLE_IME, enableList_[std::string(ENABLE_IME)], targetUserId) != ErrorCode::NO_ERROR ||
GetEnableData(ENABLE_KEYBOARD, enableList_[std::string(ENABLE_KEYBOARD)], targetUserId) != ErrorCode::NO_ERROR) {
GetEnableData(ENABLE_KEYBOARD, enableList_[std::string(ENABLE_KEYBOARD)], targetUserId) !=
ErrorCode::NO_ERROR) {
IMSA_HILOGE("get enable list failed!");
return;
}

View File

@ -451,8 +451,8 @@ int32_t ImeInfoInquirer::GetSubProperty(int32_t userId, const std::string &subNa
auto extInfo = std::find_if(extInfos.begin(), extInfos.end(),
[&subName](const ExtensionAbilityInfo &info) { return info.name == subName; });
if (extInfo == extInfos.end()) {
IMSA_HILOGE("subtype %{public}s do not found", subName.c_str());
return ErrorCode::ERROR_BAD_PARAMETERS;
IMSA_HILOGE("subtype %{public}s not found", subName.c_str());
extInfo = extInfos.begin();
}
subProp.labelId = extInfo->labelId;
subProp.label = GetStringById(extInfo->bundleName, extInfo->moduleName, extInfo->labelId, userId);
@ -500,11 +500,15 @@ int32_t ImeInfoInquirer::GetSubProperty(int32_t userId, const std::string &subNa
IMSA_HILOGE("failed to parse subtype!");
return ret;
}
auto subtype = std::find_if(subtypes.begin(), subtypes.end(),
[&subName](const Subtype &subtype) { return subtype.id == subName; });
if (subtypes.empty()) {
IMSA_HILOGE("subtypes is empty");
return ErrorCode::ERROR_PACKAGE_MANAGER;
}
auto subtype = std::find_if(
subtypes.begin(), subtypes.end(), [&subName](const Subtype &subtype) { return subtype.id == subName; });
if (subtype == subtypes.end()) {
IMSA_HILOGE("subtype %{public}s do not found", subName.c_str());
return ErrorCode::ERROR_BAD_PARAMETERS;
IMSA_HILOGE("subtype %{public}s not found", subName.c_str());
subtype = subtypes.begin();
}
subProp.label = subtype->label;
subProp.name = extInfo.bundleName;

View File

@ -733,7 +733,8 @@ int32_t InputMethodSystemAbility::SwitchInputType(const SwitchInfo &switchInfo)
}
return ret;
}
IMSA_HILOGD("need to switch ime: %{public}s|%{public}s.", switchInfo.bundleName.c_str(), switchInfo.subName.c_str());
IMSA_HILOGD("need to switch ime: %{public}s|%{public}s.", switchInfo.bundleName.c_str(),
switchInfo.subName.c_str());
auto targetImeProperty = ImeInfoInquirer::GetInstance().GetImeByBundleName(userId_, switchInfo.bundleName);
if (targetImeProperty == nullptr) {
return ErrorCode::ERROR_NULL_POINTER;
@ -884,7 +885,7 @@ int32_t InputMethodSystemAbility::OnUserStarted(const Message *msg)
int32_t InputMethodSystemAbility::OnUserRemoved(const Message *msg)
{
if (msg != nullptr || msg->msgContent_ == nullptr) {
if (msg == nullptr || msg->msgContent_ == nullptr) {
IMSA_HILOGE("Aborted! Message is nullptr.");
return ErrorCode::ERROR_NULL_POINTER;
}

View File

@ -113,8 +113,8 @@ void PerUserSession::RemoveClientInfo(const sptr<IRemoteObject> &client, bool is
IMSA_HILOGI("client[%{public}d] is removed.", clientInfo->pid);
}
void PerUserSession::UpdateClientInfo(const sptr<IRemoteObject> &client,
const std::unordered_map<UpdateFlag, std::variant<bool, uint32_t, ImeType, ClientState, TextTotalConfig>> &updateInfos)
void PerUserSession::UpdateClientInfo(const sptr<IRemoteObject> &client, const std::unordered_map<UpdateFlag,
std::variant<bool, uint32_t, ImeType, ClientState, TextTotalConfig>> &updateInfos)
{
if (client == nullptr) {
IMSA_HILOGE("client is nullptr!");