1 /* 2 * Copyright (c) 2023 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 INPUTMETHOD_IMF_INPUT_METHOD_ENGINE_LISTENER_IMPL_H 17 #define INPUTMETHOD_IMF_INPUT_METHOD_ENGINE_LISTENER_IMPL_H 18 19 #include <condition_variable> 20 21 #include "input_method_engine_listener.h" 22 23 namespace OHOS { 24 namespace MiscServices { 25 class InputMethodEngineListenerImpl : public InputMethodEngineListener { 26 public: InputMethodEngineListenerImpl()27 InputMethodEngineListenerImpl(){}; ~InputMethodEngineListenerImpl()28 ~InputMethodEngineListenerImpl(){}; 29 static bool keyboardState_; 30 static bool isInputStart_; 31 static uint32_t windowId_; 32 static std::mutex imeListenerMutex_; 33 static std::condition_variable imeListenerCv_; 34 static bool isEnable_; 35 static bool isInputFinish_; 36 static std::unordered_map<std::string, PrivateDataValue> privateCommand_; 37 static void ResetParam(); 38 static bool WaitInputStart(); 39 static bool WaitInputFinish(); 40 static bool WaitSetCallingWindow(uint32_t windowId); 41 static bool WaitSendPrivateCommand(const std::unordered_map<std::string, PrivateDataValue> &privateCommand); 42 void OnKeyboardStatus(bool isShow) override; 43 void OnInputStart() override; 44 int32_t OnInputStop() override; 45 void OnSecurityChange(int32_t security) override; 46 void OnSetCallingWindow(uint32_t windowId) override; 47 void OnSetSubtype(const SubProperty &property) override; 48 void OnInputFinish() override; 49 void ReceivePrivateCommand(const std::unordered_map<std::string, PrivateDataValue> &privateCommand) override; 50 bool IsEnable() override; 51 }; 52 } // namespace MiscServices 53 } // namespace OHOS 54 55 #endif //INPUTMETHOD_IMF_INPUT_METHOD_ENGINE_LISTENER_IMPL_H 56