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 OHOS_ABILITY_RUNTIME_RESOURCE_CONFIG_HELPER_H 17 #define OHOS_ABILITY_RUNTIME_RESOURCE_CONFIG_HELPER_H 18 #include "resource_manager.h" 19 #include "configuration.h" 20 #ifdef SUPPORT_GRAPHICS 21 #include "display_manager.h" 22 #endif 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 27 } 28 namespace AbilityRuntime { 29 class ResourceConfigHelper { 30 public: 31 ResourceConfigHelper() = default; 32 ~ResourceConfigHelper() = default; 33 std::string GetLanguage(); 34 void SetLanguage(std::string language); 35 std::string GetColormode(); 36 void SetColormode(std::string colormode); 37 std::string GetHasPointerDevice(); 38 void SetHasPointerDevice(std::string hasPointerDevice); 39 std::string GetMcc(); 40 void SetMcc(std::string mcc); 41 std::string GetMnc(); 42 void SetMnc(std::string mnc); 43 void SetThemeId(std::string themeId); 44 45 void UpdateResConfig(const AppExecFwk::Configuration &configuration, 46 std::shared_ptr<Global::Resource::ResourceManager> resourceManager); 47 48 static bool ConvertStringToUint32(std::string source, uint32_t &result); 49 50 private: 51 std::string language_; 52 std::string colormode_; 53 std::string hasPointerDevice_; 54 std::string mcc_; 55 std::string mnc_; 56 std::string colorModeIsSetByApp_; 57 std::string themeId_; 58 59 void UpdateResConfig(std::unique_ptr<Global::Resource::ResConfig> &resConfig); 60 }; 61 } // namespace AbilityRuntime 62 } // namespace OHOS 63 #endif // OHOS_ABILITY_RUNTIME_RESOURCE_CONFIG_HELPER_H 64