1 /* 2 * Copyright (C) 2021 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 FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H 17 #define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H 18 19 #include "i_input_method_core.h" 20 #include "input_attribute.h" 21 #include "input_method_property.h" 22 #include "iremote_object.h" 23 #include "iremote_proxy.h" 24 #include "message_option.h" 25 #include "message_parcel.h" 26 27 namespace OHOS { 28 namespace MiscServices { 29 class InputMethodCoreProxy : public IRemoteProxy<IInputMethodCore> { 30 public: 31 explicit InputMethodCoreProxy(const sptr<IRemoteObject> &object); 32 ~InputMethodCoreProxy(); 33 34 DISALLOW_COPY_AND_MOVE(InputMethodCoreProxy); 35 36 int32_t StartInput(const InputClientInfo &clientInfo, bool isBindFromClient) override; 37 int32_t StopInput(const sptr<IRemoteObject> &channel) override; 38 int32_t ShowKeyboard() override; 39 int32_t HideKeyboard() override; 40 int32_t InitInputControlChannel(const sptr<IInputControlChannel> &inputControlChannel) override; 41 int32_t StopInputService(bool isTerminateIme) override; 42 int32_t SetSubtype(const SubProperty &property) override; 43 bool IsEnable() override; 44 int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) override; 45 int32_t OnSecurityChange(int32_t security) override; 46 int32_t OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) override; 47 void OnClientInactive(const sptr<IRemoteObject> &channel) override; 48 49 private: 50 static inline BrokerDelegator<InputMethodCoreProxy> delegator_; 51 using ParcelHandler = std::function<bool(MessageParcel &)>; 52 int32_t SendRequest(int code, ParcelHandler input = nullptr, ParcelHandler output = nullptr, 53 MessageOption option = MessageOption::TF_SYNC); 54 }; 55 } // namespace MiscServices 56 } // namespace OHOS 57 #endif // FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H 58