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 SERVICES_INCLUDE_IME_INFO_ENQUIRER_H 17 #define SERVICES_INCLUDE_IME_INFO_ENQUIRER_H 18 19 #include <memory> 20 #include <mutex> 21 #include <string> 22 #include <vector> 23 24 #include "input_method_property.h" 25 #include "input_method_status.h" 26 27 namespace OHOS { 28 namespace MiscServices { 29 struct ImeNativeCfg { 30 std::string imeId; 31 std::string bundleName; 32 std::string subName; 33 std::string extName; 34 }; 35 36 class ImeInfoInquirer { 37 public: 38 static ImeInfoInquirer &GetInstance(); 39 std::shared_ptr<ImeInfo> GetDefaultImeInfo(int32_t userId); 40 std::shared_ptr<Property> GetCurrentInputMethod(int32_t userId); 41 std::shared_ptr<Property> GetDefaultImeCfgProp(); 42 bool GetImeAppId(int32_t userId, const std::string &bundleName, std::string &appId); 43 bool GetImeVersionCode(int32_t userId, const std::string &bundleName, uint32_t &versionCode); 44 ImeNativeCfg GetDefaultIme(); 45 46 private: 47 static std::shared_ptr<ImeInfo> defaultIme_; 48 static std::shared_ptr<Property> currentIme_; 49 static std::shared_ptr<Property> defaultImeProperty_; 50 }; 51 } // namespace MiscServices 52 } // namespace OHOS 53 #endif // SERVICES_INCLUDE_IME_INFO_ENQUIRER_H 54