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 FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H 17 #define FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H 18 19 #include <mutex> 20 #include <condition_variable> 21 #include <cstdint> 22 #include "iremote_broker.h" 23 #include "iremote_stub.h" 24 #include "i_input_method_agent.h" 25 #include "input_channel.h" 26 #include "message_parcel.h" 27 #include "input_attribute.h" 28 #include "i_input_data_channel.h" 29 #include "i_input_method_core.h" 30 #include "i_input_control_channel.h" 31 #include "keyboard_type.h" 32 #include "message_handler.h" 33 34 namespace OHOS { 35 namespace MiscServices { 36 class InputMethodCoreStub : public IRemoteStub<IInputMethodCore> { 37 public: 38 DISALLOW_COPY_AND_MOVE(InputMethodCoreStub); 39 explicit InputMethodCoreStub(int userId); 40 virtual ~InputMethodCoreStub(); 41 virtual int OnRemoteRequest(uint32_t code, 42 MessageParcel &data, 43 MessageParcel &reply, 44 MessageOption &option) override; 45 46 virtual int32_t initializeInput(sptr<IRemoteObject>& startInputToken, int32_t displayId, 47 sptr<IInputControlChannel>& inputControlChannel) override; 48 virtual bool startInput(const sptr<IInputDataChannel>& inputDataChannel, 49 const InputAttribute& editorAttribute, 50 bool supportPhysicalKbd) override; 51 virtual int32_t stopInput() override; 52 virtual bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel) override; 53 virtual bool hideKeyboard(int32_t flags)override; 54 virtual int32_t setKeyboardType(const KeyboardType& type) override; 55 virtual int32_t getKeyboardWindowHeight(int32_t retHeight) override; 56 virtual int32_t InitInputControlChannel(sptr<IInputControlChannel> &inputControlChannel) override; 57 virtual void SetClientState(bool state) override; 58 virtual void StopInputService(std::string imeId) override; 59 void SetMessageHandler(MessageHandler *msgHandler); 60 61 private: 62 int userId_; 63 MessageHandler *msgHandler_; 64 }; 65 } 66 } 67 #endif // FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H 68