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

Signed-off-by: 赵凌岚 <>
This commit is contained in:
赵凌岚 2022-11-01 02:32:23 +00:00 committed by Gitee
commit 8f596df856
6 changed files with 84 additions and 80 deletions

View File

@ -140,8 +140,7 @@ int32_t InputMethodSystemAbilityProxy::ListInputMethod(InputMethodStatus status,
IMSA_HILOGI("%{public}s in", __func__);
int32_t ret = SendRequest(
LIST_INPUT_METHOD, [status](MessageParcel &data) { return ITypesUtil::Marshal(data, uint32_t(status)); },
[&props](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, props);
});
[&props](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, props); });
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("InputMethodSystemAbilityProxy::SendRequest failed, ret %{public}d", ret);
}

View File

@ -17,72 +17,72 @@
namespace OHOS {
namespace MiscServices {
const std::map<int32_t, int32_t> JsUtils::ERROR_CODE_MAP = {
{ ErrorCode::ERROR_STATUS_PERMISSION_DENIED, EXCEPTION_PERMISSION },
{ ErrorCode::ERROR_REMOTE_IME_DIED, EXCEPTION_IMENGINE },
{ ErrorCode::ERROR_RESTART_IME_FAILED, EXCEPTION_IMENGINE },
{ ErrorCode::ERROR_REMOTE_CLIENT_DIED, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_CLIENT_DUPLICATED, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_CLIENT_NOT_FOUND, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_CLIENT_NULL_POINTER, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_NOT_IME_PACKAGE, EXCEPTION_SETTINGS },
{ ErrorCode::ERROR_IME_PACKAGE_DUPLICATED, EXCEPTION_SETTINGS },
{ ErrorCode::ERROR_SETTING_SAME_VALUE, EXCEPTION_SETTINGS },
{ ErrorCode::ERROR_NULL_POINTER, EXCEPTION_IMMS },
{ ErrorCode::ERROR_BAD_PARAMETERS, EXCEPTION_IMMS },
{ ErrorCode::ERROR_SERVICE_START_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_NOT_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_ALREADY_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_NOT_UNLOCKED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_NOT_LOCKED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_NOT_AVAILABLE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_SECURITY_IME_NOT_AVAILABLE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_TOKEN_CREATE_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_TOKEN_DESTROY_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_BIND_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_UNBIND_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_START_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_STOP_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_SHOW_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_HIDE_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_NOT_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_IS_OCCUPIED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_IS_NOT_SHOWING, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_ALREADY_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_NO_NEXT_IME, EXCEPTION_IMMS },
{ ErrorCode::ERROR_CLIENTWINDOW_NOT_FOCUSED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_CLIENT_NOT_WINDOW, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_PROPERTY_MARSHALL, EXCEPTION_IMMS },
{ ErrorCode::ERROR_GETTING_CURRENT_IME, EXCEPTION_IMMS },
{ ErrorCode::ERROR_LIST_IME, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_NULL_POINTER, EXCEPTION_IMMS },
{ ErrorCode::ERROR_PERSIST_CONFIG, EXCEPTION_CONFPERSIST },
{ ErrorCode::ERROR_PACKAGE_MANAGER, EXCEPTION_PACKAGEMANAGER },
{ ErrorCode::ERROR_EX_UNSUPPORTED_OPERATION, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_SERVICE_SPECIFIC, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_PARCELABLE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_ILLEGAL_ARGUMENT, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_ILLEGAL_STATE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_NETWORK_MAIN_THREAD, EXCEPTION_IMMS },
{ ErrorCode::ERROR_STATUS_UNKNOWN_ERROR, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_NO_MEMORY, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_INVALID_OPERATION, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_BAD_VALUE, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_BAD_TYPE, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_NAME_NOT_FOUND, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_ALREADY_EXISTS, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_DEAD_OBJECT, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_FAILED_TRANSACTION, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_BAD_INDEX, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_NOT_ENOUGH_DATA, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_WOULD_BLOCK, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_TIMED_OUT, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_FDS_NOT_ALLOWED, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_UNEXPECTED_NULL, EXCEPTION_OTHERS },
};
const std::map<int32_t, int32_t> JsUtils::ERROR_CODE_MAP = {
{ ErrorCode::ERROR_STATUS_PERMISSION_DENIED, EXCEPTION_PERMISSION },
{ ErrorCode::ERROR_REMOTE_IME_DIED, EXCEPTION_IMENGINE },
{ ErrorCode::ERROR_RESTART_IME_FAILED, EXCEPTION_IMENGINE },
{ ErrorCode::ERROR_REMOTE_CLIENT_DIED, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_CLIENT_DUPLICATED, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_CLIENT_NOT_FOUND, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_CLIENT_NULL_POINTER, EXCEPTION_IMCLIENT },
{ ErrorCode::ERROR_NOT_IME_PACKAGE, EXCEPTION_SETTINGS },
{ ErrorCode::ERROR_IME_PACKAGE_DUPLICATED, EXCEPTION_SETTINGS },
{ ErrorCode::ERROR_SETTING_SAME_VALUE, EXCEPTION_SETTINGS },
{ ErrorCode::ERROR_NULL_POINTER, EXCEPTION_IMMS },
{ ErrorCode::ERROR_BAD_PARAMETERS, EXCEPTION_IMMS },
{ ErrorCode::ERROR_SERVICE_START_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_NOT_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_ALREADY_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_NOT_UNLOCKED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_USER_NOT_LOCKED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_NOT_AVAILABLE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_SECURITY_IME_NOT_AVAILABLE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_TOKEN_CREATE_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_TOKEN_DESTROY_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_BIND_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_UNBIND_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_START_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_STOP_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_SHOW_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_HIDE_FAILED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_NOT_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_IS_OCCUPIED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_KBD_IS_NOT_SHOWING, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_ALREADY_STARTED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_NO_NEXT_IME, EXCEPTION_IMMS },
{ ErrorCode::ERROR_CLIENTWINDOW_NOT_FOCUSED, EXCEPTION_IMMS },
{ ErrorCode::ERROR_CLIENT_NOT_WINDOW, EXCEPTION_IMMS },
{ ErrorCode::ERROR_IME_PROPERTY_MARSHALL, EXCEPTION_IMMS },
{ ErrorCode::ERROR_GETTING_CURRENT_IME, EXCEPTION_IMMS },
{ ErrorCode::ERROR_LIST_IME, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_NULL_POINTER, EXCEPTION_IMMS },
{ ErrorCode::ERROR_PERSIST_CONFIG, EXCEPTION_CONFPERSIST },
{ ErrorCode::ERROR_PACKAGE_MANAGER, EXCEPTION_PACKAGEMANAGER },
{ ErrorCode::ERROR_EX_UNSUPPORTED_OPERATION, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_SERVICE_SPECIFIC, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_PARCELABLE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_ILLEGAL_ARGUMENT, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_ILLEGAL_STATE, EXCEPTION_IMMS },
{ ErrorCode::ERROR_EX_NETWORK_MAIN_THREAD, EXCEPTION_IMMS },
{ ErrorCode::ERROR_STATUS_UNKNOWN_ERROR, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_NO_MEMORY, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_INVALID_OPERATION, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_BAD_VALUE, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_BAD_TYPE, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_NAME_NOT_FOUND, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_ALREADY_EXISTS, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_DEAD_OBJECT, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_FAILED_TRANSACTION, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_BAD_INDEX, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_NOT_ENOUGH_DATA, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_WOULD_BLOCK, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_TIMED_OUT, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_FDS_NOT_ALLOWED, EXCEPTION_OTHERS },
{ ErrorCode::ERROR_STATUS_UNEXPECTED_NULL, EXCEPTION_OTHERS },
};
const std::map<int32_t, std::string> JsUtils::ERROR_CODE_CONVERT_MESSAGE_MAP = {
const std::map<int32_t, std::string> JsUtils::ERROR_CODE_CONVERT_MESSAGE_MAP = {
{ EXCEPTION_PERMISSION, "the permissions check fails." },
{ EXCEPTION_PARAMCHECK, "the parameters check fails." },
{ EXCEPTION_UNSUPPORTED, "call unsupported api." },

View File

@ -29,19 +29,20 @@ namespace OHOS {
int32_t enterKeyType = 0;
int32_t inputOption = 0;
static bool Marshalling(const InputAttribute &in, MessageParcel &data) {
return data.WriteInt32(in.inputPattern)
&& data.WriteInt32(in.enterKeyType)
static bool Marshalling(const InputAttribute &in, MessageParcel &data)
{
return data.WriteInt32(in.inputPattern) && data.WriteInt32(in.enterKeyType)
&& data.WriteInt32(in.inputOption);
}
static bool Unmarshalling(InputAttribute &out, MessageParcel &data) {
return data.ReadInt32(out.inputPattern)
&& data.ReadInt32(out.enterKeyType)
&& data.ReadInt32(out.inputOption);
static bool Unmarshalling(InputAttribute &out, MessageParcel &data)
{
return data.ReadInt32(out.inputPattern) && data.ReadInt32(out.enterKeyType)
&& data.ReadInt32(out.inputOption);
}
bool GetSecurityFlag() {
bool GetSecurityFlag()
{
return inputPattern == PATTERN_PASSWORD;
}
};

View File

@ -340,7 +340,8 @@ namespace MiscServices {
IMSA_HILOGE("InputMethodSystemAbility::PrepareInput clientDeathRecipient is nullptr");
return ErrorCode::ERROR_EX_NULL_POINTER;
}
return session->OnPrepareInput({ pid, uid, userId_, displayId, client, channel, clientDeathRecipient, attribute });
return session->OnPrepareInput(
{ pid, uid, userId_, displayId, client, channel, clientDeathRecipient, attribute });
};
int32_t InputMethodSystemAbility::ReleaseInput(sptr<IInputClient> client)
@ -666,7 +667,8 @@ namespace MiscServices {
}
// Deprecated because of no permission check, kept for compatibility
int32_t InputMethodSystemAbility::SetCoreAndAgentDeprecated(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent)
int32_t InputMethodSystemAbility::SetCoreAndAgentDeprecated(
sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent)
{
return SetCoreAndAgent(core, agent);
};
@ -1381,7 +1383,8 @@ namespace MiscServices {
return iface_cast<AAFwk::IAbilityManager>(abilityMsObj);
}
SubProperty InputMethodSystemAbility::FindSubPropertyByCompare(const std::string &bundleName, CompareHandler compare)
SubProperty InputMethodSystemAbility::FindSubPropertyByCompare(
const std::string &bundleName, CompareHandler compare)
{
IMSA_HILOGI("InputMethodSystemAbility::FindSubPropertyByCompare");
std::vector<SubProperty> subProps = {};

View File

@ -120,7 +120,8 @@ namespace MiscServices {
\param[out] inputMethodProperty the input method engine information for the given package
\return ErrorCode
*/
int Platform::GetInputMethodProperty(int userId, const std::u16string& packageName, InputMethodInfo *inputMethodProperty)
int Platform::GetInputMethodProperty(
int userId, const std::u16string &packageName, InputMethodInfo *inputMethodProperty)
{
if (!platformApi) {
return ErrorCode::ERROR_NULL_POINTER;

View File

@ -42,7 +42,7 @@ namespace MiscServices {
case NOTIFY_EVENT: {
int eventId = data.ReadInt32();
int userId = data.ReadInt32();
std::vector<std::u16string> eventContent;
std::vector<std::u16string> eventContent;
int size = data.ReadInt32();
if (size < 0) {
return ErrorCode::ERROR_STATUS_BAD_VALUE;