122736c2fSopenharmony_ci/* 222736c2fSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 322736c2fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 422736c2fSopenharmony_ci * you may not use this file except in compliance with the License. 522736c2fSopenharmony_ci * You may obtain a copy of the License at 622736c2fSopenharmony_ci * 722736c2fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 822736c2fSopenharmony_ci * 922736c2fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1022736c2fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1122736c2fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1222736c2fSopenharmony_ci * See the License for the specific language governing permissions and 1322736c2fSopenharmony_ci * limitations under the License. 1422736c2fSopenharmony_ci */ 1522736c2fSopenharmony_ci 1622736c2fSopenharmony_ci#ifndef SERVICES_INCLUDE_FULL_IME_INFO_MANAGER_H 1722736c2fSopenharmony_ci#define SERVICES_INCLUDE_FULL_IME_INFO_MANAGER_H 1822736c2fSopenharmony_ci 1922736c2fSopenharmony_ci#include <chrono> 2022736c2fSopenharmony_ci#include <map> 2122736c2fSopenharmony_ci 2222736c2fSopenharmony_ci#include "input_method_property.h" 2322736c2fSopenharmony_ci#include "timer.h" 2422736c2fSopenharmony_cinamespace OHOS { 2522736c2fSopenharmony_cinamespace MiscServices { 2622736c2fSopenharmony_ci 2722736c2fSopenharmony_ciclass FullImeInfoManager { 2822736c2fSopenharmony_cipublic: 2922736c2fSopenharmony_ci static FullImeInfoManager &GetInstance(); 3022736c2fSopenharmony_ci int32_t Init(); // osAccount start/bundle scan finished/regular update 3122736c2fSopenharmony_ci int32_t Add(int32_t userId); // user switched 3222736c2fSopenharmony_ci int32_t Update(); // language change 3322736c2fSopenharmony_ci int32_t Delete(int32_t userId); // user removed 3422736c2fSopenharmony_ci int32_t Add(int32_t userId, const std::string &bundleName); // package added 3522736c2fSopenharmony_ci int32_t Delete(int32_t userId, const std::string &bundleName); // package removed 3622736c2fSopenharmony_ci int32_t Update(int32_t userId, const std::string &bundleName); // package changed 3722736c2fSopenharmony_ci std::vector<FullImeInfo> Get(int32_t userId); 3822736c2fSopenharmony_ci std::string Get(int32_t userId, uint32_t tokenId); 3922736c2fSopenharmony_ci bool Get(const std::string &bundleName, int32_t userId, FullImeInfo &fullImeInfo); 4022736c2fSopenharmony_ci bool Has(int32_t userId, const std::string &bundleName); 4122736c2fSopenharmony_ci 4222736c2fSopenharmony_ciprivate: 4322736c2fSopenharmony_ci FullImeInfoManager(); 4422736c2fSopenharmony_ci ~FullImeInfoManager(); 4522736c2fSopenharmony_ci std::mutex lock_; 4622736c2fSopenharmony_ci std::map<int32_t, std::vector<FullImeInfo>> fullImeInfos_; 4722736c2fSopenharmony_ci Utils::Timer timer_{ "imeInfoCacheInitTimer" }; 4822736c2fSopenharmony_ci uint32_t timerId_{ 0 }; 4922736c2fSopenharmony_ci}; 5022736c2fSopenharmony_ci} // namespace MiscServices 5122736c2fSopenharmony_ci} // namespace OHOS 5222736c2fSopenharmony_ci#endif // SERVICES_INCLUDE_FULL_IME_INFO_MANAGER_H 53