1 /* 2 * Copyright (c) 2024 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 DMS_SWITCH_STATUS_DEPENDENCY_H 17 #define DMS_SWITCH_STATUS_DEPENDENCY_H 18 19 #include <string> 20 #include <mutex> 21 #include <vector> 22 #include "datashare_helper.h" 23 24 namespace OHOS { 25 namespace DistributedSchedule { 26 27 class SwitchStatusDependency { 28 public: 29 static SwitchStatusDependency &GetInstance(); 30 bool IsContinueSwitchOn(); 31 32 static const std::string SETTINGS_USER_SECURE_URI; 33 static const std::string SETTINGS_DATA_FIELD_KEY; 34 static const std::string SETTINGS_DATA_FIELD_VAL; 35 static const std::string CONTINUE_SWITCH_STATUS_KEY; 36 static const std::string CONTINUE_SWITCH_OFF; 37 static const std::string CONTINUE_SWITCH_ON; 38 39 private: 40 std::string GetSwitchStatus(const std::string &key, const std::string &defaultValue); 41 std::shared_ptr<DataShare::DataShareHelper> GetDataShareHelper(); 42 std::mutex dataShareMutex_; 43 std::string switchStatus_; 44 }; 45 } // namespace DistributedSchedule 46 } // namespace OHOS 47 48 #endif // DMS_SWITCH_STATUS_DEPENDENCY_H