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_INPUTCONTROLCHANNELSTUB_H 17 #define FM_IMMS_PROJECT_INPUTCONTROLCHANNELSTUB_H 18 19 #include <mutex> 20 #include <condition_variable> 21 #include "iremote_broker.h" 22 #include "iremote_stub.h" 23 #include "i_input_method_agent.h" 24 #include "input_channel.h" 25 #include "message_parcel.h" 26 #include "i_input_control_channel.h" 27 28 namespace OHOS { 29 namespace MiscServices { 30 class InputControlChannelStub : public IRemoteStub<IInputControlChannel> { 31 public: 32 explicit InputControlChannelStub(int userId); 33 virtual ~InputControlChannelStub(); 34 virtual int OnRemoteRequest(uint32_t code, 35 MessageParcel &data, 36 MessageParcel &reply, 37 MessageOption &option) override; 38 virtual void hideKeyboardSelf(int flags) override; 39 virtual bool advanceToNext(bool isCurrentIme) override; 40 virtual void setDisplayMode(int mode) override; 41 virtual void onKeyboardShowed() override; 42 43 void ResetFlag(); 44 bool WaitKeyboardReady(); 45 private: 46 int userId_; 47 48 std::mutex mtx; 49 std::condition_variable cv; 50 bool agentReadyFlag = false; 51 bool keyboardReadyFlag = false; 52 const int32_t sleepTime = 300; 53 }; 54 } 55 } 56 #endif // FM_IMMS_PROJECT_INPUTCONTROLCHANNELSTUB_H 57