122736c2fSopenharmony_ci/* 222736c2fSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 322736c2fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 422736c2fSopenharmony_ci * you may not use this file except in compliance with the License. 522736c2fSopenharmony_ci * You may obtain a copy of the License at 622736c2fSopenharmony_ci * 722736c2fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 822736c2fSopenharmony_ci * 922736c2fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1022736c2fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1122736c2fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1222736c2fSopenharmony_ci * See the License for the specific language governing permissions and 1322736c2fSopenharmony_ci * limitations under the License. 1422736c2fSopenharmony_ci */ 1522736c2fSopenharmony_ci 1622736c2fSopenharmony_ci#ifndef SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H 1722736c2fSopenharmony_ci#define SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H 1822736c2fSopenharmony_ci 1922736c2fSopenharmony_ci#include <errors.h> 2022736c2fSopenharmony_ci 2122736c2fSopenharmony_ci#include "global.h" 2222736c2fSopenharmony_ci#include "i_input_method_system_ability.h" 2322736c2fSopenharmony_ci#include "inputmethod_service_ipc_interface_code.h" 2422736c2fSopenharmony_ci#include "iremote_stub.h" 2522736c2fSopenharmony_ci#include "message_parcel.h" 2622736c2fSopenharmony_ci#include "refbase.h" 2722736c2fSopenharmony_ci 2822736c2fSopenharmony_cinamespace OHOS ::MiscServices { 2922736c2fSopenharmony_ciclass InputMethodSystemAbilityStub : public IRemoteStub<IInputMethodSystemAbility> { 3022736c2fSopenharmony_cipublic: 3122736c2fSopenharmony_ci int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 3222736c2fSopenharmony_ci 3322736c2fSopenharmony_ciprivate: 3422736c2fSopenharmony_ci int32_t InvalidRequest(MessageParcel &data, MessageParcel &reply) 3522736c2fSopenharmony_ci { 3622736c2fSopenharmony_ci return ERR_UNKNOWN_TRANSACTION; 3722736c2fSopenharmony_ci }; 3822736c2fSopenharmony_ci 3922736c2fSopenharmony_ci int32_t StartInputOnRemote(MessageParcel &data, MessageParcel &reply); 4022736c2fSopenharmony_ci 4122736c2fSopenharmony_ci int32_t ShowCurrentInputOnRemote(MessageParcel &data, MessageParcel &reply); 4222736c2fSopenharmony_ci 4322736c2fSopenharmony_ci int32_t HideCurrentInputOnRemote(MessageParcel &data, MessageParcel &reply); 4422736c2fSopenharmony_ci 4522736c2fSopenharmony_ci int32_t StopInputSessionOnRemote(MessageParcel &data, MessageParcel &reply); 4622736c2fSopenharmony_ci 4722736c2fSopenharmony_ci int32_t ShowInputOnRemote(MessageParcel &data, MessageParcel &reply); 4822736c2fSopenharmony_ci 4922736c2fSopenharmony_ci int32_t HideInputOnRemote(MessageParcel &data, MessageParcel &reply); 5022736c2fSopenharmony_ci 5122736c2fSopenharmony_ci int32_t ReleaseInputOnRemote(MessageParcel &data, MessageParcel &reply); 5222736c2fSopenharmony_ci 5322736c2fSopenharmony_ci int32_t RequestShowInputOnRemote(MessageParcel &data, MessageParcel &reply); 5422736c2fSopenharmony_ci 5522736c2fSopenharmony_ci int32_t RequestHideInputOnRemote(MessageParcel &data, MessageParcel &reply); 5622736c2fSopenharmony_ci 5722736c2fSopenharmony_ci int32_t GetCurrentInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 5822736c2fSopenharmony_ci 5922736c2fSopenharmony_ci int32_t GetCurrentInputMethodSubtypeOnRemote(MessageParcel &data, MessageParcel &reply); 6022736c2fSopenharmony_ci 6122736c2fSopenharmony_ci int32_t ListInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 6222736c2fSopenharmony_ci 6322736c2fSopenharmony_ci int32_t SwitchInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 6422736c2fSopenharmony_ci 6522736c2fSopenharmony_ci int32_t DisplayOptionalInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 6622736c2fSopenharmony_ci 6722736c2fSopenharmony_ci int32_t SetCoreAndAgentOnRemote(MessageParcel &data, MessageParcel &reply); 6822736c2fSopenharmony_ci 6922736c2fSopenharmony_ci int32_t UnRegisteredProxyImeOnRemote(MessageParcel &data, MessageParcel &reply); 7022736c2fSopenharmony_ci 7122736c2fSopenharmony_ci int32_t ListInputMethodSubtypeOnRemote(MessageParcel &data, MessageParcel &reply); 7222736c2fSopenharmony_ci 7322736c2fSopenharmony_ci int32_t ListCurrentInputMethodSubtypeOnRemote(MessageParcel &data, MessageParcel &reply); 7422736c2fSopenharmony_ci 7522736c2fSopenharmony_ci int32_t PanelStatusChangeOnRemote(MessageParcel &data, MessageParcel &reply); 7622736c2fSopenharmony_ci 7722736c2fSopenharmony_ci int32_t UpdateListenEventFlagOnRemote(MessageParcel &data, MessageParcel &reply); 7822736c2fSopenharmony_ci 7922736c2fSopenharmony_ci int32_t IsCurrentImeOnRemote(MessageParcel &data, MessageParcel &reply); 8022736c2fSopenharmony_ci 8122736c2fSopenharmony_ci int32_t IsInputTypeSupportedOnRemote(MessageParcel &data, MessageParcel &reply); 8222736c2fSopenharmony_ci 8322736c2fSopenharmony_ci int32_t StartInputTypeOnRemote(MessageParcel &data, MessageParcel &reply); 8422736c2fSopenharmony_ci 8522736c2fSopenharmony_ci int32_t ExitCurrentInputTypeOnRemote(MessageParcel &data, MessageParcel &reply); 8622736c2fSopenharmony_ci 8722736c2fSopenharmony_ci // Deprecated because of no permission check, kept for compatibility 8822736c2fSopenharmony_ci int32_t HideCurrentInputOnRemoteDeprecated(MessageParcel &data, MessageParcel &reply); 8922736c2fSopenharmony_ci 9022736c2fSopenharmony_ci int32_t ShowCurrentInputOnRemoteDeprecated(MessageParcel &data, MessageParcel &reply); 9122736c2fSopenharmony_ci 9222736c2fSopenharmony_ci int32_t GetDefaultInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 9322736c2fSopenharmony_ci 9422736c2fSopenharmony_ci int32_t IsDefaultImeSetOnRemote(MessageParcel &data, MessageParcel &reply); 9522736c2fSopenharmony_ci 9622736c2fSopenharmony_ci int32_t EnableImeOnRemote(MessageParcel &data, MessageParcel &reply); 9722736c2fSopenharmony_ci 9822736c2fSopenharmony_ci int32_t GetInputMethodConfigOnRemote(MessageParcel &data, MessageParcel &reply); 9922736c2fSopenharmony_ci 10022736c2fSopenharmony_ci int32_t IsPanelShownOnRemote(MessageParcel &data, MessageParcel &reply); 10122736c2fSopenharmony_ci 10222736c2fSopenharmony_ci int32_t GetSecurityModeOnRemote(MessageParcel &data, MessageParcel &reply); 10322736c2fSopenharmony_ci 10422736c2fSopenharmony_ci int32_t IsDefaultImeOnRemote(MessageParcel &data, MessageParcel &reply); 10522736c2fSopenharmony_ci 10622736c2fSopenharmony_ci int32_t ConnectSystemCmdOnRemote(MessageParcel &data, MessageParcel &reply); 10722736c2fSopenharmony_ci 10822736c2fSopenharmony_ci int32_t IsCurrentImeByPidOnRemote(MessageParcel &data, MessageParcel &reply); 10922736c2fSopenharmony_ci 11022736c2fSopenharmony_ci int32_t InitConnectOnRemote(MessageParcel &data, MessageParcel &reply); 11122736c2fSopenharmony_ci 11222736c2fSopenharmony_ci using RequestHandler = int32_t (InputMethodSystemAbilityStub::*)(MessageParcel &, MessageParcel &); 11322736c2fSopenharmony_ci static inline constexpr RequestHandler HANDLERS[static_cast<uint32_t>(InputMethodInterfaceCode::IMS_CMD_END)] = { 11422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::InvalidRequest, 11522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::START_INPUT)] = 11622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::StartInputOnRemote, 11722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_CURRENT_INPUT)] = 11822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ShowCurrentInputOnRemote, 11922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_CURRENT_INPUT)] = 12022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::HideCurrentInputOnRemote, 12122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_INPUT)] = 12222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ShowInputOnRemote, 12322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_INPUT)] = 12422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::HideInputOnRemote, 12522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::STOP_INPUT_SESSION)] = 12622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::StopInputSessionOnRemote, 12722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::RELEASE_INPUT)] = 12822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ReleaseInputOnRemote, 12922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::REQUEST_SHOW_INPUT)] = 13022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::RequestShowInputOnRemote, 13122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::REQUEST_HIDE_INPUT)] = 13222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::RequestHideInputOnRemote, 13322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::GET_CURRENT_INPUT_METHOD)] = 13422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::GetCurrentInputMethodOnRemote, 13522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::GET_CURRENT_INPUT_METHOD_SUBTYPE)] = 13622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::GetCurrentInputMethodSubtypeOnRemote, 13722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::LIST_INPUT_METHOD)] = 13822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ListInputMethodOnRemote, 13922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::LIST_INPUT_METHOD_SUBTYPE)] = 14022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ListInputMethodSubtypeOnRemote, 14122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::LIST_CURRENT_INPUT_METHOD_SUBTYPE)] = 14222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ListCurrentInputMethodSubtypeOnRemote, 14322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::SWITCH_INPUT_METHOD)] = 14422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::SwitchInputMethodOnRemote, 14522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::DISPLAY_OPTIONAL_INPUT_METHOD)] = 14622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::DisplayOptionalInputMethodOnRemote, 14722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::SET_CORE_AND_AGENT)] = 14822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::SetCoreAndAgentOnRemote, 14922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_CURRENT_INPUT_DEPRECATED)] = 15022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ShowCurrentInputOnRemoteDeprecated, 15122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_CURRENT_INPUT_DEPRECATED)] = 15222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::HideCurrentInputOnRemoteDeprecated, 15322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::PANEL_STATUS_CHANGE)] = 15422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::PanelStatusChangeOnRemote, 15522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::UPDATE_LISTEN_EVENT_FLAG)] = 15622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::UpdateListenEventFlagOnRemote, 15722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::IS_CURRENT_IME)] = 15822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::IsCurrentImeOnRemote, 15922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::UNREGISTERED_PROXY_IME)] = 16022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::UnRegisteredProxyImeOnRemote, 16122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::IS_INPUT_TYPE_SUPPORTED)] = 16222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::IsInputTypeSupportedOnRemote, 16322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::START_INPUT_TYPE)] = 16422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::StartInputTypeOnRemote, 16522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::EXIT_CURRENT_INPUT_TYPE)] = 16622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ExitCurrentInputTypeOnRemote, 16722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::GET_DEFAULT_INPUT_METHOD)] = 16822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::GetDefaultInputMethodOnRemote, 16922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::GET_INPUT_METHOD_SETTINGS)] = 17022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::GetInputMethodConfigOnRemote, 17122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::IS_PANEL_SHOWN)] = 17222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::IsPanelShownOnRemote, 17322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::GET_SECURITY_MODE)] = 17422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::GetSecurityModeOnRemote, 17522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::IS_DEFAULT_IME)] = 17622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::IsDefaultImeOnRemote, 17722736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::CONNECT_SYSTEM_CMD)] = 17822736c2fSopenharmony_ci &InputMethodSystemAbilityStub::ConnectSystemCmdOnRemote, 17922736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::IS_CURRENT_IME_BY_PID)] = 18022736c2fSopenharmony_ci &InputMethodSystemAbilityStub::IsCurrentImeByPidOnRemote, 18122736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::INIT_CONNECT)] = 18222736c2fSopenharmony_ci &InputMethodSystemAbilityStub::InitConnectOnRemote, 18322736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::IS_DEFAULT_IME_SET)] = 18422736c2fSopenharmony_ci &InputMethodSystemAbilityStub::IsDefaultImeSetOnRemote, 18522736c2fSopenharmony_ci [static_cast<uint32_t>(InputMethodInterfaceCode::ENABLE_IME)] = 18622736c2fSopenharmony_ci &InputMethodSystemAbilityStub::EnableImeOnRemote, 18722736c2fSopenharmony_ci }; 18822736c2fSopenharmony_ci}; 18922736c2fSopenharmony_ci} // namespace OHOS::MiscServices 19022736c2fSopenharmony_ci 19122736c2fSopenharmony_ci#endif // SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H 192