1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H 17 #define SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H 18 19 #include "i_input_method_system_ability.h" 20 #include "inputmethod_service_ipc_interface_code.h" 21 #include "iremote_stub.h" 22 23 namespace OHOS ::MiscServices { 24 class InputMethodSystemAbilityStub : public IRemoteStub<IInputMethodSystemAbility> { 25 public: 26 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 27 28 private: InvalidRequest(MessageParcel & data,MessageParcel & reply)29 int32_t InvalidRequest(MessageParcel &data, MessageParcel &reply) 30 { 31 return ERR_UNKNOWN_TRANSACTION; 32 }; 33 34 int32_t StartInputOnRemote(MessageParcel &data, MessageParcel &reply); 35 36 int32_t ShowCurrentInputOnRemote(MessageParcel &data, MessageParcel &reply); 37 38 int32_t HideCurrentInputOnRemote(MessageParcel &data, MessageParcel &reply); 39 40 int32_t StopInputSessionOnRemote(MessageParcel &data, MessageParcel &reply); 41 42 int32_t ShowInputOnRemote(MessageParcel &data, MessageParcel &reply); 43 44 int32_t HideInputOnRemote(MessageParcel &data, MessageParcel &reply); 45 46 int32_t ReleaseInputOnRemote(MessageParcel &data, MessageParcel &reply); 47 48 int32_t RequestShowInputOnRemote(MessageParcel &data, MessageParcel &reply); 49 50 int32_t RequestHideInputOnRemote(MessageParcel &data, MessageParcel &reply); 51 52 int32_t GetCurrentInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 53 54 int32_t GetCurrentInputMethodSubtypeOnRemote(MessageParcel &data, MessageParcel &reply); 55 56 int32_t ListInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 57 58 int32_t SwitchInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 59 60 int32_t DisplayOptionalInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 61 62 int32_t SetCoreAndAgentOnRemote(MessageParcel &data, MessageParcel &reply); 63 64 int32_t UnRegisteredProxyImeOnRemote(MessageParcel &data, MessageParcel &reply); 65 66 int32_t ListInputMethodSubtypeOnRemote(MessageParcel &data, MessageParcel &reply); 67 68 int32_t ListCurrentInputMethodSubtypeOnRemote(MessageParcel &data, MessageParcel &reply); 69 70 int32_t PanelStatusChangeOnRemote(MessageParcel &data, MessageParcel &reply); 71 72 int32_t UpdateListenEventFlagOnRemote(MessageParcel &data, MessageParcel &reply); 73 74 int32_t IsCurrentImeOnRemote(MessageParcel &data, MessageParcel &reply); 75 76 int32_t IsInputTypeSupportedOnRemote(MessageParcel &data, MessageParcel &reply); 77 78 int32_t StartInputTypeOnRemote(MessageParcel &data, MessageParcel &reply); 79 80 int32_t ExitCurrentInputTypeOnRemote(MessageParcel &data, MessageParcel &reply); 81 82 // Deprecated because of no permission check, kept for compatibility 83 int32_t HideCurrentInputOnRemoteDeprecated(MessageParcel &data, MessageParcel &reply); 84 85 int32_t ShowCurrentInputOnRemoteDeprecated(MessageParcel &data, MessageParcel &reply); 86 87 int32_t GetDefaultInputMethodOnRemote(MessageParcel &data, MessageParcel &reply); 88 89 int32_t IsDefaultImeSetOnRemote(MessageParcel &data, MessageParcel &reply); 90 91 int32_t EnableImeOnRemote(MessageParcel &data, MessageParcel &reply); 92 93 int32_t GetInputMethodConfigOnRemote(MessageParcel &data, MessageParcel &reply); 94 95 int32_t IsPanelShownOnRemote(MessageParcel &data, MessageParcel &reply); 96 97 int32_t GetSecurityModeOnRemote(MessageParcel &data, MessageParcel &reply); 98 99 int32_t IsDefaultImeOnRemote(MessageParcel &data, MessageParcel &reply); 100 101 int32_t ConnectSystemCmdOnRemote(MessageParcel &data, MessageParcel &reply); 102 103 int32_t IsCurrentImeByPidOnRemote(MessageParcel &data, MessageParcel &reply); 104 105 int32_t InitConnectOnRemote(MessageParcel &data, MessageParcel &reply); 106 107 int32_t SetCallingWindowOnRemote(MessageParcel &data, MessageParcel &reply); 108 109 int32_t GetInputStartInfoOnRemote(MessageParcel &data, MessageParcel &reply); 110 111 int32_t GetInputMethodStateOnRemote(MessageParcel &data, MessageParcel &reply); 112 113 int32_t IsSystemAppOnRemote(MessageParcel &data, MessageParcel &reply); 114 115 using RequestHandler = int32_t (InputMethodSystemAbilityStub::*)(MessageParcel &, MessageParcel &); 116 static inline constexpr RequestHandler HANDLERS[static_cast<uint32_t>(InputMethodInterfaceCode::IMS_CMD_END)] = { 117 &InputMethodSystemAbilityStub::InvalidRequest, 118 [static_cast<uint32_t>(InputMethodInterfaceCode::START_INPUT)] = 119 &InputMethodSystemAbilityStub::StartInputOnRemote, 120 [static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_CURRENT_INPUT)] = 121 &InputMethodSystemAbilityStub::ShowCurrentInputOnRemote, 122 [static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_CURRENT_INPUT)] = 123 &InputMethodSystemAbilityStub::HideCurrentInputOnRemote, 124 [static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_INPUT)] = 125 &InputMethodSystemAbilityStub::ShowInputOnRemote, 126 [static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_INPUT)] = 127 &InputMethodSystemAbilityStub::HideInputOnRemote, 128 [static_cast<uint32_t>(InputMethodInterfaceCode::STOP_INPUT_SESSION)] = 129 &InputMethodSystemAbilityStub::StopInputSessionOnRemote, 130 [static_cast<uint32_t>(InputMethodInterfaceCode::RELEASE_INPUT)] = 131 &InputMethodSystemAbilityStub::ReleaseInputOnRemote, 132 [static_cast<uint32_t>(InputMethodInterfaceCode::REQUEST_SHOW_INPUT)] = 133 &InputMethodSystemAbilityStub::RequestShowInputOnRemote, 134 [static_cast<uint32_t>(InputMethodInterfaceCode::REQUEST_HIDE_INPUT)] = 135 &InputMethodSystemAbilityStub::RequestHideInputOnRemote, 136 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_CURRENT_INPUT_METHOD)] = 137 &InputMethodSystemAbilityStub::GetCurrentInputMethodOnRemote, 138 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_CURRENT_INPUT_METHOD_SUBTYPE)] = 139 &InputMethodSystemAbilityStub::GetCurrentInputMethodSubtypeOnRemote, 140 [static_cast<uint32_t>(InputMethodInterfaceCode::LIST_INPUT_METHOD)] = 141 &InputMethodSystemAbilityStub::ListInputMethodOnRemote, 142 [static_cast<uint32_t>(InputMethodInterfaceCode::LIST_INPUT_METHOD_SUBTYPE)] = 143 &InputMethodSystemAbilityStub::ListInputMethodSubtypeOnRemote, 144 [static_cast<uint32_t>(InputMethodInterfaceCode::LIST_CURRENT_INPUT_METHOD_SUBTYPE)] = 145 &InputMethodSystemAbilityStub::ListCurrentInputMethodSubtypeOnRemote, 146 [static_cast<uint32_t>(InputMethodInterfaceCode::SWITCH_INPUT_METHOD)] = 147 &InputMethodSystemAbilityStub::SwitchInputMethodOnRemote, 148 [static_cast<uint32_t>(InputMethodInterfaceCode::DISPLAY_OPTIONAL_INPUT_METHOD)] = 149 &InputMethodSystemAbilityStub::DisplayOptionalInputMethodOnRemote, 150 [static_cast<uint32_t>(InputMethodInterfaceCode::SET_CORE_AND_AGENT)] = 151 &InputMethodSystemAbilityStub::SetCoreAndAgentOnRemote, 152 [static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_CURRENT_INPUT_DEPRECATED)] = 153 &InputMethodSystemAbilityStub::ShowCurrentInputOnRemoteDeprecated, 154 [static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_CURRENT_INPUT_DEPRECATED)] = 155 &InputMethodSystemAbilityStub::HideCurrentInputOnRemoteDeprecated, 156 [static_cast<uint32_t>(InputMethodInterfaceCode::PANEL_STATUS_CHANGE)] = 157 &InputMethodSystemAbilityStub::PanelStatusChangeOnRemote, 158 [static_cast<uint32_t>(InputMethodInterfaceCode::UPDATE_LISTEN_EVENT_FLAG)] = 159 &InputMethodSystemAbilityStub::UpdateListenEventFlagOnRemote, 160 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_CURRENT_IME)] = 161 &InputMethodSystemAbilityStub::IsCurrentImeOnRemote, 162 [static_cast<uint32_t>(InputMethodInterfaceCode::UNREGISTERED_PROXY_IME)] = 163 &InputMethodSystemAbilityStub::UnRegisteredProxyImeOnRemote, 164 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_INPUT_TYPE_SUPPORTED)] = 165 &InputMethodSystemAbilityStub::IsInputTypeSupportedOnRemote, 166 [static_cast<uint32_t>(InputMethodInterfaceCode::START_INPUT_TYPE)] = 167 &InputMethodSystemAbilityStub::StartInputTypeOnRemote, 168 [static_cast<uint32_t>(InputMethodInterfaceCode::EXIT_CURRENT_INPUT_TYPE)] = 169 &InputMethodSystemAbilityStub::ExitCurrentInputTypeOnRemote, 170 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_DEFAULT_INPUT_METHOD)] = 171 &InputMethodSystemAbilityStub::GetDefaultInputMethodOnRemote, 172 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_INPUT_METHOD_SETTINGS)] = 173 &InputMethodSystemAbilityStub::GetInputMethodConfigOnRemote, 174 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_PANEL_SHOWN)] = 175 &InputMethodSystemAbilityStub::IsPanelShownOnRemote, 176 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_SECURITY_MODE)] = 177 &InputMethodSystemAbilityStub::GetSecurityModeOnRemote, 178 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_DEFAULT_IME)] = 179 &InputMethodSystemAbilityStub::IsDefaultImeOnRemote, 180 [static_cast<uint32_t>(InputMethodInterfaceCode::CONNECT_SYSTEM_CMD)] = 181 &InputMethodSystemAbilityStub::ConnectSystemCmdOnRemote, 182 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_CURRENT_IME_BY_PID)] = 183 &InputMethodSystemAbilityStub::IsCurrentImeByPidOnRemote, 184 [static_cast<uint32_t>(InputMethodInterfaceCode::INIT_CONNECT)] = 185 &InputMethodSystemAbilityStub::InitConnectOnRemote, 186 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_DEFAULT_IME_SET)] = 187 &InputMethodSystemAbilityStub::IsDefaultImeSetOnRemote, 188 [static_cast<uint32_t>(InputMethodInterfaceCode::ENABLE_IME)] = 189 &InputMethodSystemAbilityStub::EnableImeOnRemote, 190 [static_cast<uint32_t>(InputMethodInterfaceCode::SET_CALLING_WINDOW)] = 191 &InputMethodSystemAbilityStub::SetCallingWindowOnRemote, 192 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_INPUT_START_INFO)] = 193 &InputMethodSystemAbilityStub::GetInputStartInfoOnRemote, 194 [static_cast<uint32_t>(InputMethodInterfaceCode::GET_IME_STATE)] = 195 &InputMethodSystemAbilityStub::GetInputMethodStateOnRemote, 196 [static_cast<uint32_t>(InputMethodInterfaceCode::IS_SYSTEM_APP)] = 197 &InputMethodSystemAbilityStub::IsSystemAppOnRemote, 198 }; 199 }; 200 } // namespace OHOS::MiscServices 201 202 #endif // SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H 203