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 SECURITY_MODE_PARSER_H 17 #define SECURITY_MODE_PARSER_H 18 19 #include <mutex> 20 #include <string> 21 #include <unordered_map> 22 #include <vector> 23 24 #include "datashare_helper.h" 25 #include "settings_data_observer.h" 26 #include "settings_data_utils.h" 27 #include "global.h" 28 29 namespace OHOS { 30 namespace MiscServices { 31 32 class SecurityModeParser : public RefBase { 33 public: 34 static sptr<SecurityModeParser> GetInstance(); 35 int32_t Initialize(const int32_t userId); 36 int32_t GetSecurityMode(const std::string bundleName, int32_t &security, const int32_t userId); 37 bool IsSecurityChange(const std::string bundleName, const int32_t userId); 38 int32_t GetFullModeList(const int32_t userId); 39 static constexpr const char *SECURITY_MODE = "settings.inputmethod.full_experience"; 40 static constexpr const char *SECURITY_KEY = "fullExperienceList"; 41 42 private: 43 SecurityModeParser() = default; 44 ~SecurityModeParser(); 45 46 bool ParseJsonData(const std::string &valueStr, const int32_t userId); 47 bool IsFullMode(const std::string bundleName); 48 static std::mutex instanceMutex_; 49 static sptr<SecurityModeParser> instance_; 50 std::mutex listMutex_; 51 std::vector<std::string> fullModeList_; 52 }; 53 } // namespace MiscServices 54 } // namespace OHOS 55 56 #endif // SECURITY_MODE_PARSER_H