123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_FRAMEWORKS_BASE_UTILS_SYSTEM_PROPERTIES_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_FRAMEWORKS_BASE_UTILS_SYSTEM_PROPERTIES_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include <atomic> 2023b3eb3cSopenharmony_ci#include <cstdint> 2123b3eb3cSopenharmony_ci#include <memory> 2223b3eb3cSopenharmony_ci#include <optional> 2323b3eb3cSopenharmony_ci#include <string> 2423b3eb3cSopenharmony_ci 2523b3eb3cSopenharmony_ci#include "base/utils/device_config.h" 2623b3eb3cSopenharmony_ci#include "base/utils/device_type.h" 2723b3eb3cSopenharmony_ci#include "base/utils/macros.h" 2823b3eb3cSopenharmony_ci 2923b3eb3cSopenharmony_cinamespace OHOS::Ace { 3023b3eb3cSopenharmony_ci 3123b3eb3cSopenharmony_cienum class ResolutionType : int32_t { 3223b3eb3cSopenharmony_ci RESOLUTION_NONE = -2, 3323b3eb3cSopenharmony_ci RESOLUTION_ANY = -1, 3423b3eb3cSopenharmony_ci RESOLUTION_LDPI = 120, 3523b3eb3cSopenharmony_ci RESOLUTION_MDPI = 160, 3623b3eb3cSopenharmony_ci RESOLUTION_HDPI = 240, 3723b3eb3cSopenharmony_ci RESOLUTION_XHDPI = 320, 3823b3eb3cSopenharmony_ci RESOLUTION_XXHDPI = 480, 3923b3eb3cSopenharmony_ci RESOLUTION_XXXHDPI = 640, 4023b3eb3cSopenharmony_ci}; 4123b3eb3cSopenharmony_ci 4223b3eb3cSopenharmony_cienum class FoldScreenType: int32_t { 4323b3eb3cSopenharmony_ci UNKNOWN = 0, 4423b3eb3cSopenharmony_ci BIG_FOLDER = 1, 4523b3eb3cSopenharmony_ci SMALL_FOLDER = 2, 4623b3eb3cSopenharmony_ci OUTER_FOLDER = 3, 4723b3eb3cSopenharmony_ci}; 4823b3eb3cSopenharmony_ci 4923b3eb3cSopenharmony_ciconstexpr int32_t MCC_UNDEFINED = 0; 5023b3eb3cSopenharmony_ciconstexpr int32_t MNC_UNDEFINED = 0; 5123b3eb3cSopenharmony_ciextern const char ENABLE_DEBUG_BOUNDARY_KEY[]; 5223b3eb3cSopenharmony_ciextern const char ENABLE_TRACE_LAYOUT_KEY[]; 5323b3eb3cSopenharmony_ciextern const char ENABLE_TRACE_INPUTEVENT_KEY[]; 5423b3eb3cSopenharmony_ciextern const char ENABLE_SECURITY_DEVELOPERMODE_KEY[]; 5523b3eb3cSopenharmony_ciextern const char ENABLE_DEBUG_STATEMGR_KEY[]; 5623b3eb3cSopenharmony_ci 5723b3eb3cSopenharmony_cienum class LongScreenType : int32_t { 5823b3eb3cSopenharmony_ci LONG = 0, 5923b3eb3cSopenharmony_ci NOT_LONG, 6023b3eb3cSopenharmony_ci LONG_SCREEN_UNDEFINED, 6123b3eb3cSopenharmony_ci}; 6223b3eb3cSopenharmony_ci 6323b3eb3cSopenharmony_cienum class ScreenShape : int32_t { 6423b3eb3cSopenharmony_ci ROUND = 0, 6523b3eb3cSopenharmony_ci NOT_ROUND, 6623b3eb3cSopenharmony_ci SCREEN_SHAPE_UNDEFINED, 6723b3eb3cSopenharmony_ci}; 6823b3eb3cSopenharmony_ci 6923b3eb3cSopenharmony_ciclass ACE_FORCE_EXPORT SystemProperties final { 7023b3eb3cSopenharmony_cipublic: 7123b3eb3cSopenharmony_ci /* 7223b3eb3cSopenharmony_ci * Init device type for Ace. 7323b3eb3cSopenharmony_ci */ 7423b3eb3cSopenharmony_ci static void InitDeviceType(DeviceType deviceType); 7523b3eb3cSopenharmony_ci 7623b3eb3cSopenharmony_ci /* 7723b3eb3cSopenharmony_ci * Init device info for Ace. 7823b3eb3cSopenharmony_ci */ 7923b3eb3cSopenharmony_ci static void InitDeviceInfo( 8023b3eb3cSopenharmony_ci int32_t deviceWidth, int32_t deviceHeight, int32_t orientation, double resolution, bool isRound); 8123b3eb3cSopenharmony_ci 8223b3eb3cSopenharmony_ci /* 8323b3eb3cSopenharmony_ci * Init device type according to system property. 8423b3eb3cSopenharmony_ci */ 8523b3eb3cSopenharmony_ci static void InitDeviceTypeBySystemProperty(); 8623b3eb3cSopenharmony_ci 8723b3eb3cSopenharmony_ci /** 8823b3eb3cSopenharmony_ci * Init fold screen type according to system property. 8923b3eb3cSopenharmony_ci */ 9023b3eb3cSopenharmony_ci static void InitFoldScreenTypeBySystemProperty(); 9123b3eb3cSopenharmony_ci 9223b3eb3cSopenharmony_ci /* 9323b3eb3cSopenharmony_ci * Get type of current device. 9423b3eb3cSopenharmony_ci */ 9523b3eb3cSopenharmony_ci static DeviceType GetDeviceType(); 9623b3eb3cSopenharmony_ci 9723b3eb3cSopenharmony_ci /* 9823b3eb3cSopenharmony_ci * Get if current device need avoid window. 9923b3eb3cSopenharmony_ci */ 10023b3eb3cSopenharmony_ci static bool GetNeedAvoidWindow(); 10123b3eb3cSopenharmony_ci 10223b3eb3cSopenharmony_ci /* 10323b3eb3cSopenharmony_ci * check SystemCapability. 10423b3eb3cSopenharmony_ci */ 10523b3eb3cSopenharmony_ci static bool IsSyscapExist(const char* cap); 10623b3eb3cSopenharmony_ci 10723b3eb3cSopenharmony_ci /** 10823b3eb3cSopenharmony_ci * Set type of current device. 10923b3eb3cSopenharmony_ci * @param deviceType 11023b3eb3cSopenharmony_ci */ 11123b3eb3cSopenharmony_ci static void SetDeviceType(DeviceType deviceType) 11223b3eb3cSopenharmony_ci { 11323b3eb3cSopenharmony_ci deviceType_ = deviceType; 11423b3eb3cSopenharmony_ci } 11523b3eb3cSopenharmony_ci 11623b3eb3cSopenharmony_ci /* 11723b3eb3cSopenharmony_ci * Get current orientation of device. 11823b3eb3cSopenharmony_ci */ 11923b3eb3cSopenharmony_ci static DeviceOrientation GetDeviceOrientation() 12023b3eb3cSopenharmony_ci { 12123b3eb3cSopenharmony_ci return orientation_; 12223b3eb3cSopenharmony_ci } 12323b3eb3cSopenharmony_ci 12423b3eb3cSopenharmony_ci /* 12523b3eb3cSopenharmony_ci * Get width of device. 12623b3eb3cSopenharmony_ci */ 12723b3eb3cSopenharmony_ci static int32_t GetDeviceWidth() 12823b3eb3cSopenharmony_ci { 12923b3eb3cSopenharmony_ci return deviceWidth_; 13023b3eb3cSopenharmony_ci } 13123b3eb3cSopenharmony_ci 13223b3eb3cSopenharmony_ci /* 13323b3eb3cSopenharmony_ci * Get height of device. 13423b3eb3cSopenharmony_ci */ 13523b3eb3cSopenharmony_ci static int32_t GetDeviceHeight() 13623b3eb3cSopenharmony_ci { 13723b3eb3cSopenharmony_ci return deviceHeight_; 13823b3eb3cSopenharmony_ci } 13923b3eb3cSopenharmony_ci 14023b3eb3cSopenharmony_ci /* 14123b3eb3cSopenharmony_ci * Set physical width of device. 14223b3eb3cSopenharmony_ci */ 14323b3eb3cSopenharmony_ci static void SetDevicePhysicalWidth(int32_t devicePhysicalWidth) 14423b3eb3cSopenharmony_ci { 14523b3eb3cSopenharmony_ci devicePhysicalWidth_ = devicePhysicalWidth; 14623b3eb3cSopenharmony_ci } 14723b3eb3cSopenharmony_ci 14823b3eb3cSopenharmony_ci /* 14923b3eb3cSopenharmony_ci * Set physical height of device. 15023b3eb3cSopenharmony_ci */ 15123b3eb3cSopenharmony_ci static void SetDevicePhysicalHeight(int32_t devicePhysicalHeight) 15223b3eb3cSopenharmony_ci { 15323b3eb3cSopenharmony_ci devicePhysicalHeight_ = devicePhysicalHeight; 15423b3eb3cSopenharmony_ci } 15523b3eb3cSopenharmony_ci 15623b3eb3cSopenharmony_ci /* 15723b3eb3cSopenharmony_ci * Get physical width of device. 15823b3eb3cSopenharmony_ci */ 15923b3eb3cSopenharmony_ci static int32_t GetDevicePhysicalWidth() 16023b3eb3cSopenharmony_ci { 16123b3eb3cSopenharmony_ci return devicePhysicalWidth_; 16223b3eb3cSopenharmony_ci } 16323b3eb3cSopenharmony_ci 16423b3eb3cSopenharmony_ci /* 16523b3eb3cSopenharmony_ci * Get physical height of device. 16623b3eb3cSopenharmony_ci */ 16723b3eb3cSopenharmony_ci static int32_t GetDevicePhysicalHeight() 16823b3eb3cSopenharmony_ci { 16923b3eb3cSopenharmony_ci return devicePhysicalHeight_; 17023b3eb3cSopenharmony_ci } 17123b3eb3cSopenharmony_ci 17223b3eb3cSopenharmony_ci /* 17323b3eb3cSopenharmony_ci * Get wght scale of device. 17423b3eb3cSopenharmony_ci */ 17523b3eb3cSopenharmony_ci static float GetFontWeightScale(); 17623b3eb3cSopenharmony_ci 17723b3eb3cSopenharmony_ci static void SetFontWeightScale(const float fontWeightScale) 17823b3eb3cSopenharmony_ci { 17923b3eb3cSopenharmony_ci if (fontWeightScale_ != fontWeightScale) { 18023b3eb3cSopenharmony_ci fontWeightScale_ = fontWeightScale; 18123b3eb3cSopenharmony_ci } 18223b3eb3cSopenharmony_ci } 18323b3eb3cSopenharmony_ci 18423b3eb3cSopenharmony_ci /* 18523b3eb3cSopenharmony_ci * Get size scale of device. 18623b3eb3cSopenharmony_ci */ 18723b3eb3cSopenharmony_ci static float GetFontScale(); 18823b3eb3cSopenharmony_ci 18923b3eb3cSopenharmony_ci static void SetFontScale(const float fontScale) 19023b3eb3cSopenharmony_ci { 19123b3eb3cSopenharmony_ci if (fontScale != fontScale_) { 19223b3eb3cSopenharmony_ci fontScale_ = fontScale; 19323b3eb3cSopenharmony_ci } 19423b3eb3cSopenharmony_ci } 19523b3eb3cSopenharmony_ci 19623b3eb3cSopenharmony_ci /* 19723b3eb3cSopenharmony_ci * Get density of default display. 19823b3eb3cSopenharmony_ci */ 19923b3eb3cSopenharmony_ci static double GetResolution() 20023b3eb3cSopenharmony_ci { 20123b3eb3cSopenharmony_ci return resolution_; 20223b3eb3cSopenharmony_ci } 20323b3eb3cSopenharmony_ci 20423b3eb3cSopenharmony_ci /* 20523b3eb3cSopenharmony_ci * Set resolution of device. 20623b3eb3cSopenharmony_ci */ 20723b3eb3cSopenharmony_ci static void SetResolution(double resolution) 20823b3eb3cSopenharmony_ci { 20923b3eb3cSopenharmony_ci resolution_ = resolution; 21023b3eb3cSopenharmony_ci } 21123b3eb3cSopenharmony_ci 21223b3eb3cSopenharmony_ci static bool GetIsScreenRound() 21323b3eb3cSopenharmony_ci { 21423b3eb3cSopenharmony_ci return isRound_; 21523b3eb3cSopenharmony_ci } 21623b3eb3cSopenharmony_ci 21723b3eb3cSopenharmony_ci static const std::string& GetBrand() 21823b3eb3cSopenharmony_ci { 21923b3eb3cSopenharmony_ci return brand_; 22023b3eb3cSopenharmony_ci } 22123b3eb3cSopenharmony_ci 22223b3eb3cSopenharmony_ci static const std::string& GetManufacturer() 22323b3eb3cSopenharmony_ci { 22423b3eb3cSopenharmony_ci return manufacturer_; 22523b3eb3cSopenharmony_ci } 22623b3eb3cSopenharmony_ci 22723b3eb3cSopenharmony_ci static const std::string& GetModel() 22823b3eb3cSopenharmony_ci { 22923b3eb3cSopenharmony_ci return model_; 23023b3eb3cSopenharmony_ci } 23123b3eb3cSopenharmony_ci 23223b3eb3cSopenharmony_ci static const std::string& GetProduct() 23323b3eb3cSopenharmony_ci { 23423b3eb3cSopenharmony_ci return product_; 23523b3eb3cSopenharmony_ci } 23623b3eb3cSopenharmony_ci 23723b3eb3cSopenharmony_ci static const std::string& GetApiVersion() 23823b3eb3cSopenharmony_ci { 23923b3eb3cSopenharmony_ci return apiVersion_; 24023b3eb3cSopenharmony_ci } 24123b3eb3cSopenharmony_ci 24223b3eb3cSopenharmony_ci static const std::string& GetReleaseType() 24323b3eb3cSopenharmony_ci { 24423b3eb3cSopenharmony_ci return releaseType_; 24523b3eb3cSopenharmony_ci } 24623b3eb3cSopenharmony_ci 24723b3eb3cSopenharmony_ci static const std::string& GetParamDeviceType() 24823b3eb3cSopenharmony_ci { 24923b3eb3cSopenharmony_ci return paramDeviceType_; 25023b3eb3cSopenharmony_ci } 25123b3eb3cSopenharmony_ci 25223b3eb3cSopenharmony_ci static std::string GetLanguage(); 25323b3eb3cSopenharmony_ci 25423b3eb3cSopenharmony_ci static std::string GetRegion(); 25523b3eb3cSopenharmony_ci 25623b3eb3cSopenharmony_ci static std::string GetNewPipePkg(); 25723b3eb3cSopenharmony_ci 25823b3eb3cSopenharmony_ci static float GetAnimationScale(); 25923b3eb3cSopenharmony_ci 26023b3eb3cSopenharmony_ci static std::string GetPartialUpdatePkg(); 26123b3eb3cSopenharmony_ci 26223b3eb3cSopenharmony_ci static int32_t GetSvgMode(); 26323b3eb3cSopenharmony_ci 26423b3eb3cSopenharmony_ci static bool GetDebugPixelMapSaveEnabled(); 26523b3eb3cSopenharmony_ci 26623b3eb3cSopenharmony_ci static bool IsPixelRoundEnabled(); 26723b3eb3cSopenharmony_ci 26823b3eb3cSopenharmony_ci static bool GetRosenBackendEnabled() 26923b3eb3cSopenharmony_ci { 27023b3eb3cSopenharmony_ci return rosenBackendEnabled_; 27123b3eb3cSopenharmony_ci } 27223b3eb3cSopenharmony_ci 27323b3eb3cSopenharmony_ci static bool GetHookModeEnabled() 27423b3eb3cSopenharmony_ci { 27523b3eb3cSopenharmony_ci return isHookModeEnabled_; 27623b3eb3cSopenharmony_ci } 27723b3eb3cSopenharmony_ci 27823b3eb3cSopenharmony_ci static bool GetDeveloperModeOn() 27923b3eb3cSopenharmony_ci { 28023b3eb3cSopenharmony_ci return developerModeOn_; 28123b3eb3cSopenharmony_ci } 28223b3eb3cSopenharmony_ci 28323b3eb3cSopenharmony_ci static bool GetDebugBoundaryEnabled() 28423b3eb3cSopenharmony_ci { 28523b3eb3cSopenharmony_ci return debugBoundaryEnabled_.load(); 28623b3eb3cSopenharmony_ci } 28723b3eb3cSopenharmony_ci 28823b3eb3cSopenharmony_ci static bool GetDebugOffsetLogEnabled() 28923b3eb3cSopenharmony_ci { 29023b3eb3cSopenharmony_ci return debugOffsetLogEnabled_; 29123b3eb3cSopenharmony_ci } 29223b3eb3cSopenharmony_ci 29323b3eb3cSopenharmony_ci static bool GetDebugAutoUIEnabled() 29423b3eb3cSopenharmony_ci { 29523b3eb3cSopenharmony_ci return debugAutoUIEnabled_; 29623b3eb3cSopenharmony_ci } 29723b3eb3cSopenharmony_ci 29823b3eb3cSopenharmony_ci static bool GetDownloadByNetworkEnabled() 29923b3eb3cSopenharmony_ci { 30023b3eb3cSopenharmony_ci return downloadByNetworkEnabled_; 30123b3eb3cSopenharmony_ci } 30223b3eb3cSopenharmony_ci 30323b3eb3cSopenharmony_ci static bool GetSvgTraceEnabled() 30423b3eb3cSopenharmony_ci { 30523b3eb3cSopenharmony_ci return svgTraceEnable_; 30623b3eb3cSopenharmony_ci } 30723b3eb3cSopenharmony_ci 30823b3eb3cSopenharmony_ci static bool GetLayoutTraceEnabled() 30923b3eb3cSopenharmony_ci { 31023b3eb3cSopenharmony_ci return layoutTraceEnable_.load(); 31123b3eb3cSopenharmony_ci } 31223b3eb3cSopenharmony_ci 31323b3eb3cSopenharmony_ci static bool GetSyncDebugTraceEnabled() 31423b3eb3cSopenharmony_ci { 31523b3eb3cSopenharmony_ci return syncDebugTraceEnable_; 31623b3eb3cSopenharmony_ci } 31723b3eb3cSopenharmony_ci 31823b3eb3cSopenharmony_ci static bool GetPixelRoundEnabled() 31923b3eb3cSopenharmony_ci { 32023b3eb3cSopenharmony_ci return pixelRoundEnable_; 32123b3eb3cSopenharmony_ci } 32223b3eb3cSopenharmony_ci 32323b3eb3cSopenharmony_ci static bool GetTextTraceEnabled() 32423b3eb3cSopenharmony_ci { 32523b3eb3cSopenharmony_ci return textTraceEnable_; 32623b3eb3cSopenharmony_ci } 32723b3eb3cSopenharmony_ci 32823b3eb3cSopenharmony_ci static bool GetSyntaxTraceEnabled() 32923b3eb3cSopenharmony_ci { 33023b3eb3cSopenharmony_ci return syntaxTraceEnable_; 33123b3eb3cSopenharmony_ci } 33223b3eb3cSopenharmony_ci 33323b3eb3cSopenharmony_ci static bool GetAccessTraceEnabled() 33423b3eb3cSopenharmony_ci { 33523b3eb3cSopenharmony_ci return accessTraceEnable_; 33623b3eb3cSopenharmony_ci } 33723b3eb3cSopenharmony_ci 33823b3eb3cSopenharmony_ci static bool GetTraceInputEventEnabled() 33923b3eb3cSopenharmony_ci { 34023b3eb3cSopenharmony_ci return traceInputEventEnable_.load(); 34123b3eb3cSopenharmony_ci } 34223b3eb3cSopenharmony_ci 34323b3eb3cSopenharmony_ci static bool GetStateManagerEnabled() 34423b3eb3cSopenharmony_ci { 34523b3eb3cSopenharmony_ci return stateManagerEnable_.load(); 34623b3eb3cSopenharmony_ci } 34723b3eb3cSopenharmony_ci 34823b3eb3cSopenharmony_ci static void SetStateManagerEnabled(bool stateManagerEnable) 34923b3eb3cSopenharmony_ci { 35023b3eb3cSopenharmony_ci stateManagerEnable_.store(stateManagerEnable); 35123b3eb3cSopenharmony_ci } 35223b3eb3cSopenharmony_ci 35323b3eb3cSopenharmony_ci static void SetFaultInjectEnabled(bool faultInjectEnable) 35423b3eb3cSopenharmony_ci { 35523b3eb3cSopenharmony_ci faultInjectEnabled_ = faultInjectEnable; 35623b3eb3cSopenharmony_ci } 35723b3eb3cSopenharmony_ci 35823b3eb3cSopenharmony_ci static bool GetFaultInjectEnabled() 35923b3eb3cSopenharmony_ci { 36023b3eb3cSopenharmony_ci return faultInjectEnabled_; 36123b3eb3cSopenharmony_ci } 36223b3eb3cSopenharmony_ci 36323b3eb3cSopenharmony_ci static bool GetBuildTraceEnabled() 36423b3eb3cSopenharmony_ci { 36523b3eb3cSopenharmony_ci return buildTraceEnable_; 36623b3eb3cSopenharmony_ci } 36723b3eb3cSopenharmony_ci 36823b3eb3cSopenharmony_ci static bool GetAccessibilityEnabled() 36923b3eb3cSopenharmony_ci { 37023b3eb3cSopenharmony_ci return accessibilityEnabled_; 37123b3eb3cSopenharmony_ci } 37223b3eb3cSopenharmony_ci 37323b3eb3cSopenharmony_ci static uint32_t GetCanvasDebugMode() 37423b3eb3cSopenharmony_ci { 37523b3eb3cSopenharmony_ci return canvasDebugMode_; 37623b3eb3cSopenharmony_ci } 37723b3eb3cSopenharmony_ci 37823b3eb3cSopenharmony_ci static bool GetDebugEnabled(); 37923b3eb3cSopenharmony_ci 38023b3eb3cSopenharmony_ci static bool GetLayoutDetectEnabled(); 38123b3eb3cSopenharmony_ci 38223b3eb3cSopenharmony_ci static bool GetGpuUploadEnabled() 38323b3eb3cSopenharmony_ci { 38423b3eb3cSopenharmony_ci return gpuUploadEnabled_; 38523b3eb3cSopenharmony_ci } 38623b3eb3cSopenharmony_ci 38723b3eb3cSopenharmony_ci static bool GetImageFrameworkEnabled() 38823b3eb3cSopenharmony_ci { 38923b3eb3cSopenharmony_ci return imageFrameworkEnable_; 39023b3eb3cSopenharmony_ci } 39123b3eb3cSopenharmony_ci 39223b3eb3cSopenharmony_ci /* 39323b3eb3cSopenharmony_ci * Set device orientation. 39423b3eb3cSopenharmony_ci */ 39523b3eb3cSopenharmony_ci static void SetDeviceOrientation(int32_t orientation); 39623b3eb3cSopenharmony_ci 39723b3eb3cSopenharmony_ci static constexpr char INVALID_PARAM[] = "N/A"; 39823b3eb3cSopenharmony_ci 39923b3eb3cSopenharmony_ci static int32_t GetMcc() 40023b3eb3cSopenharmony_ci { 40123b3eb3cSopenharmony_ci return mcc_; 40223b3eb3cSopenharmony_ci } 40323b3eb3cSopenharmony_ci 40423b3eb3cSopenharmony_ci static int32_t GetMnc() 40523b3eb3cSopenharmony_ci { 40623b3eb3cSopenharmony_ci return mnc_; 40723b3eb3cSopenharmony_ci } 40823b3eb3cSopenharmony_ci 40923b3eb3cSopenharmony_ci static void SetColorMode(ColorMode colorMode) 41023b3eb3cSopenharmony_ci { 41123b3eb3cSopenharmony_ci if (colorMode_ != colorMode) { 41223b3eb3cSopenharmony_ci colorMode_ = colorMode; 41323b3eb3cSopenharmony_ci } 41423b3eb3cSopenharmony_ci } 41523b3eb3cSopenharmony_ci 41623b3eb3cSopenharmony_ci static ColorMode GetColorMode() 41723b3eb3cSopenharmony_ci { 41823b3eb3cSopenharmony_ci return colorMode_; 41923b3eb3cSopenharmony_ci } 42023b3eb3cSopenharmony_ci 42123b3eb3cSopenharmony_ci static void SetDeviceAccess(bool isDeviceAccess) 42223b3eb3cSopenharmony_ci { 42323b3eb3cSopenharmony_ci isDeviceAccess_ = isDeviceAccess; 42423b3eb3cSopenharmony_ci } 42523b3eb3cSopenharmony_ci 42623b3eb3cSopenharmony_ci static bool GetDeviceAccess() 42723b3eb3cSopenharmony_ci { 42823b3eb3cSopenharmony_ci return isDeviceAccess_; 42923b3eb3cSopenharmony_ci } 43023b3eb3cSopenharmony_ci 43123b3eb3cSopenharmony_ci static void InitMccMnc(int32_t mcc, int32_t mnc); 43223b3eb3cSopenharmony_ci 43323b3eb3cSopenharmony_ci static ScreenShape GetScreenShape() 43423b3eb3cSopenharmony_ci { 43523b3eb3cSopenharmony_ci return screenShape_; 43623b3eb3cSopenharmony_ci } 43723b3eb3cSopenharmony_ci 43823b3eb3cSopenharmony_ci static int GetArkProperties(); 43923b3eb3cSopenharmony_ci 44023b3eb3cSopenharmony_ci static std::string GetMemConfigProperty(); 44123b3eb3cSopenharmony_ci 44223b3eb3cSopenharmony_ci static std::string GetArkBundleName(); 44323b3eb3cSopenharmony_ci 44423b3eb3cSopenharmony_ci static size_t GetGcThreadNum(); 44523b3eb3cSopenharmony_ci 44623b3eb3cSopenharmony_ci static size_t GetLongPauseTime(); 44723b3eb3cSopenharmony_ci 44823b3eb3cSopenharmony_ci static void SetUnZipHap(bool unZipHap = true) 44923b3eb3cSopenharmony_ci { 45023b3eb3cSopenharmony_ci unZipHap_ = unZipHap; 45123b3eb3cSopenharmony_ci } 45223b3eb3cSopenharmony_ci 45323b3eb3cSopenharmony_ci static bool GetUnZipHap() 45423b3eb3cSopenharmony_ci { 45523b3eb3cSopenharmony_ci return unZipHap_; 45623b3eb3cSopenharmony_ci } 45723b3eb3cSopenharmony_ci 45823b3eb3cSopenharmony_ci static bool GetAsmInterpreterEnabled(); 45923b3eb3cSopenharmony_ci 46023b3eb3cSopenharmony_ci static std::string GetAsmOpcodeDisableRange(); 46123b3eb3cSopenharmony_ci 46223b3eb3cSopenharmony_ci static bool IsScoringEnabled(const std::string& name); 46323b3eb3cSopenharmony_ci 46423b3eb3cSopenharmony_ci static bool IsWindowSizeAnimationEnabled() 46523b3eb3cSopenharmony_ci { 46623b3eb3cSopenharmony_ci return windowAnimationEnabled_; 46723b3eb3cSopenharmony_ci } 46823b3eb3cSopenharmony_ci 46923b3eb3cSopenharmony_ci static bool IsAstcEnabled() 47023b3eb3cSopenharmony_ci { 47123b3eb3cSopenharmony_ci return astcEnabled_; 47223b3eb3cSopenharmony_ci } 47323b3eb3cSopenharmony_ci 47423b3eb3cSopenharmony_ci static bool GetWindowRectResizeEnabled(); 47523b3eb3cSopenharmony_ci 47623b3eb3cSopenharmony_ci static int32_t GetAstcMaxError() 47723b3eb3cSopenharmony_ci { 47823b3eb3cSopenharmony_ci return astcMax_; 47923b3eb3cSopenharmony_ci } 48023b3eb3cSopenharmony_ci 48123b3eb3cSopenharmony_ci static int32_t GetAstcPsnr() 48223b3eb3cSopenharmony_ci { 48323b3eb3cSopenharmony_ci return astcPsnr_; 48423b3eb3cSopenharmony_ci } 48523b3eb3cSopenharmony_ci 48623b3eb3cSopenharmony_ci static bool IsImageFileCacheConvertAstcEnabled() 48723b3eb3cSopenharmony_ci { 48823b3eb3cSopenharmony_ci return imageFileCacheConvertAstc_; 48923b3eb3cSopenharmony_ci } 49023b3eb3cSopenharmony_ci 49123b3eb3cSopenharmony_ci static int32_t GetImageFileCacheConvertAstcThreshold() 49223b3eb3cSopenharmony_ci { 49323b3eb3cSopenharmony_ci return imageFileCacheConvertAstcThreshold_; 49423b3eb3cSopenharmony_ci } 49523b3eb3cSopenharmony_ci 49623b3eb3cSopenharmony_ci static void SetExtSurfaceEnabled(bool extSurfaceEnabled) 49723b3eb3cSopenharmony_ci { 49823b3eb3cSopenharmony_ci extSurfaceEnabled_ = extSurfaceEnabled; 49923b3eb3cSopenharmony_ci } 50023b3eb3cSopenharmony_ci 50123b3eb3cSopenharmony_ci static bool GetExtSurfaceEnabled() 50223b3eb3cSopenharmony_ci { 50323b3eb3cSopenharmony_ci return extSurfaceEnabled_; 50423b3eb3cSopenharmony_ci } 50523b3eb3cSopenharmony_ci 50623b3eb3cSopenharmony_ci static bool GetAllowWindowOpenMethodEnabled(); 50723b3eb3cSopenharmony_ci 50823b3eb3cSopenharmony_ci static uint32_t GetDumpFrameCount() 50923b3eb3cSopenharmony_ci { 51023b3eb3cSopenharmony_ci return dumpFrameCount_; 51123b3eb3cSopenharmony_ci } 51223b3eb3cSopenharmony_ci 51323b3eb3cSopenharmony_ci static bool GetIsUseMemoryMonitor(); 51423b3eb3cSopenharmony_ci 51523b3eb3cSopenharmony_ci static bool IsFormAnimationLimited(); 51623b3eb3cSopenharmony_ci 51723b3eb3cSopenharmony_ci static bool GetResourceDecoupling(); 51823b3eb3cSopenharmony_ci 51923b3eb3cSopenharmony_ci static int32_t GetJankFrameThreshold(); 52023b3eb3cSopenharmony_ci 52123b3eb3cSopenharmony_ci static bool GetTitleStyleEnabled(); 52223b3eb3cSopenharmony_ci 52323b3eb3cSopenharmony_ci static std::string GetCustomTitleFilePath(); 52423b3eb3cSopenharmony_ci 52523b3eb3cSopenharmony_ci static bool Is24HourClock(); 52623b3eb3cSopenharmony_ci 52723b3eb3cSopenharmony_ci static std::optional<bool> GetRtlEnabled(); 52823b3eb3cSopenharmony_ci 52923b3eb3cSopenharmony_ci static bool GetEnableScrollableItemPool() 53023b3eb3cSopenharmony_ci { 53123b3eb3cSopenharmony_ci return enableScrollableItemPool_; 53223b3eb3cSopenharmony_ci } 53323b3eb3cSopenharmony_ci 53423b3eb3cSopenharmony_ci static bool GetDisplaySyncSkipEnabled(); 53523b3eb3cSopenharmony_ci 53623b3eb3cSopenharmony_ci static bool GetNavigationBlurEnabled(); 53723b3eb3cSopenharmony_ci 53823b3eb3cSopenharmony_ci static bool GetGridCacheEnabled(); 53923b3eb3cSopenharmony_ci 54023b3eb3cSopenharmony_ci static bool GetGridIrregularLayoutEnabled(); 54123b3eb3cSopenharmony_ci 54223b3eb3cSopenharmony_ci static bool WaterFlowUseSegmentedLayout(); 54323b3eb3cSopenharmony_ci 54423b3eb3cSopenharmony_ci static bool GetSideBarContainerBlurEnable(); 54523b3eb3cSopenharmony_ci 54623b3eb3cSopenharmony_ci using EnableSystemParameterCallback = void (*)(const char* key, const char* value, void* context); 54723b3eb3cSopenharmony_ci 54823b3eb3cSopenharmony_ci static void AddWatchSystemParameter(const char* key, void* context, EnableSystemParameterCallback callback); 54923b3eb3cSopenharmony_ci 55023b3eb3cSopenharmony_ci static void RemoveWatchSystemParameter(const char* key, void* context, EnableSystemParameterCallback callback); 55123b3eb3cSopenharmony_ci static void EnableSystemParameterTraceLayoutCallback(const char* key, const char* value, void* context); 55223b3eb3cSopenharmony_ci static void EnableSystemParameterTraceInputEventCallback(const char* key, const char* value, void* context); 55323b3eb3cSopenharmony_ci static void EnableSystemParameterSecurityDevelopermodeCallback(const char* key, const char* value, void* context); 55423b3eb3cSopenharmony_ci static void EnableSystemParameterDebugStatemgrCallback(const char* key, const char* value, void* context); 55523b3eb3cSopenharmony_ci static void EnableSystemParameterDebugBoundaryCallback(const char* key, const char* value, void* context); 55623b3eb3cSopenharmony_ci static void EnableSystemParameterPerformanceMonitorCallback(const char* key, const char* value, void* context); 55723b3eb3cSopenharmony_ci static float GetDefaultResolution(); 55823b3eb3cSopenharmony_ci 55923b3eb3cSopenharmony_ci static void SetLayoutTraceEnabled(bool layoutTraceEnable); 56023b3eb3cSopenharmony_ci 56123b3eb3cSopenharmony_ci static void SetInputEventTraceEnabled(bool inputEventTraceEnable); 56223b3eb3cSopenharmony_ci 56323b3eb3cSopenharmony_ci static void SetSecurityDevelopermodeLayoutTraceEnabled(bool layoutTraceEnable); 56423b3eb3cSopenharmony_ci 56523b3eb3cSopenharmony_ci static void SetDebugBoundaryEnabled(bool debugBoundaryEnabled); 56623b3eb3cSopenharmony_ci 56723b3eb3cSopenharmony_ci static void SetPerformanceMonitorEnabled(bool performanceMonitorEnable); 56823b3eb3cSopenharmony_ci 56923b3eb3cSopenharmony_ci static bool GetAcePerformanceMonitorEnabled() 57023b3eb3cSopenharmony_ci { 57123b3eb3cSopenharmony_ci return acePerformanceMonitorEnable_.load(); 57223b3eb3cSopenharmony_ci } 57323b3eb3cSopenharmony_ci 57423b3eb3cSopenharmony_ci static bool GetAceCommercialLogEnabled() 57523b3eb3cSopenharmony_ci { 57623b3eb3cSopenharmony_ci return aceCommercialLogEnable_; 57723b3eb3cSopenharmony_ci } 57823b3eb3cSopenharmony_ci 57923b3eb3cSopenharmony_ci static std::string GetAtomicServiceBundleName(); 58023b3eb3cSopenharmony_ci 58123b3eb3cSopenharmony_ci static std::pair<float, float> GetDarkModeBrightnessPercent() 58223b3eb3cSopenharmony_ci { 58323b3eb3cSopenharmony_ci return brightUpPercent_; 58423b3eb3cSopenharmony_ci } 58523b3eb3cSopenharmony_ci 58623b3eb3cSopenharmony_ci static bool IsOpIncEnable(); 58723b3eb3cSopenharmony_ci 58823b3eb3cSopenharmony_ci static float GetDragStartDampingRatio(); 58923b3eb3cSopenharmony_ci 59023b3eb3cSopenharmony_ci static float GetDragStartPanDistanceThreshold(); 59123b3eb3cSopenharmony_ci 59223b3eb3cSopenharmony_ci static bool IsSmallFoldProduct(); 59323b3eb3cSopenharmony_ci 59423b3eb3cSopenharmony_ci static std::string GetWebDebugRenderMode(); 59523b3eb3cSopenharmony_ci 59623b3eb3cSopenharmony_ci static std::string GetDebugInspectorId(); 59723b3eb3cSopenharmony_ci 59823b3eb3cSopenharmony_ci static double GetSrollableVelocityScale(); 59923b3eb3cSopenharmony_ci 60023b3eb3cSopenharmony_ci static double GetSrollableFriction(); 60123b3eb3cSopenharmony_ci 60223b3eb3cSopenharmony_ciprivate: 60323b3eb3cSopenharmony_ci static bool opincEnabled_; 60423b3eb3cSopenharmony_ci static bool developerModeOn_; 60523b3eb3cSopenharmony_ci static bool svgTraceEnable_; 60623b3eb3cSopenharmony_ci static std::atomic<bool> layoutTraceEnable_; 60723b3eb3cSopenharmony_ci static std::atomic<bool> traceInputEventEnable_; 60823b3eb3cSopenharmony_ci static bool buildTraceEnable_; 60923b3eb3cSopenharmony_ci static bool syncDebugTraceEnable_; 61023b3eb3cSopenharmony_ci static bool pixelRoundEnable_; 61123b3eb3cSopenharmony_ci static bool textTraceEnable_; 61223b3eb3cSopenharmony_ci static bool syntaxTraceEnable_; 61323b3eb3cSopenharmony_ci static bool accessTraceEnable_; 61423b3eb3cSopenharmony_ci static bool accessibilityEnabled_; 61523b3eb3cSopenharmony_ci static uint32_t canvasDebugMode_; 61623b3eb3cSopenharmony_ci static bool isRound_; 61723b3eb3cSopenharmony_ci static bool isDeviceAccess_; 61823b3eb3cSopenharmony_ci static int32_t deviceWidth_; 61923b3eb3cSopenharmony_ci static int32_t deviceHeight_; 62023b3eb3cSopenharmony_ci static int32_t devicePhysicalWidth_; 62123b3eb3cSopenharmony_ci static int32_t devicePhysicalHeight_; 62223b3eb3cSopenharmony_ci static double resolution_; // density of the default display 62323b3eb3cSopenharmony_ci static DeviceType deviceType_; 62423b3eb3cSopenharmony_ci static bool needAvoidWindow_; 62523b3eb3cSopenharmony_ci static DeviceOrientation orientation_; 62623b3eb3cSopenharmony_ci static std::string brand_; 62723b3eb3cSopenharmony_ci static std::string manufacturer_; 62823b3eb3cSopenharmony_ci static std::string model_; 62923b3eb3cSopenharmony_ci static std::string product_; 63023b3eb3cSopenharmony_ci static std::string apiVersion_; 63123b3eb3cSopenharmony_ci static std::string releaseType_; 63223b3eb3cSopenharmony_ci static std::string paramDeviceType_; 63323b3eb3cSopenharmony_ci static int32_t mcc_; 63423b3eb3cSopenharmony_ci static int32_t mnc_; 63523b3eb3cSopenharmony_ci static ColorMode colorMode_; 63623b3eb3cSopenharmony_ci static ScreenShape screenShape_; 63723b3eb3cSopenharmony_ci static LongScreenType LongScreen_; 63823b3eb3cSopenharmony_ci static bool unZipHap_; 63923b3eb3cSopenharmony_ci static bool rosenBackendEnabled_; 64023b3eb3cSopenharmony_ci static bool windowAnimationEnabled_; 64123b3eb3cSopenharmony_ci static bool debugEnabled_; 64223b3eb3cSopenharmony_ci static bool layoutDetectEnabled_; 64323b3eb3cSopenharmony_ci static std::atomic<bool> debugBoundaryEnabled_; 64423b3eb3cSopenharmony_ci static bool debugAutoUIEnabled_; // for AutoUI Test 64523b3eb3cSopenharmony_ci static bool debugOffsetLogEnabled_; 64623b3eb3cSopenharmony_ci static bool downloadByNetworkEnabled_; 64723b3eb3cSopenharmony_ci static bool gpuUploadEnabled_; 64823b3eb3cSopenharmony_ci static bool isHookModeEnabled_; 64923b3eb3cSopenharmony_ci static bool astcEnabled_; 65023b3eb3cSopenharmony_ci static int32_t astcMax_; 65123b3eb3cSopenharmony_ci static int32_t astcPsnr_; 65223b3eb3cSopenharmony_ci static bool imageFileCacheConvertAstc_; 65323b3eb3cSopenharmony_ci static int32_t imageFileCacheConvertAstcThreshold_; 65423b3eb3cSopenharmony_ci static bool extSurfaceEnabled_; 65523b3eb3cSopenharmony_ci static uint32_t dumpFrameCount_; 65623b3eb3cSopenharmony_ci static bool resourceDecoupling_; 65723b3eb3cSopenharmony_ci static bool enableScrollableItemPool_; 65823b3eb3cSopenharmony_ci static bool navigationBlurEnabled_; 65923b3eb3cSopenharmony_ci static bool gridCacheEnabled_; 66023b3eb3cSopenharmony_ci static bool sideBarContainerBlurEnable_; 66123b3eb3cSopenharmony_ci static std::atomic<bool> stateManagerEnable_; 66223b3eb3cSopenharmony_ci static std::atomic<bool> acePerformanceMonitorEnable_; 66323b3eb3cSopenharmony_ci static bool aceCommercialLogEnable_; 66423b3eb3cSopenharmony_ci static bool faultInjectEnabled_; 66523b3eb3cSopenharmony_ci static bool imageFrameworkEnable_; 66623b3eb3cSopenharmony_ci static std::pair<float, float> brightUpPercent_; 66723b3eb3cSopenharmony_ci static float dragStartDampingRatio_; 66823b3eb3cSopenharmony_ci static float dragStartPanDisThreshold_; 66923b3eb3cSopenharmony_ci static float fontScale_; 67023b3eb3cSopenharmony_ci static float fontWeightScale_; 67123b3eb3cSopenharmony_ci static bool windowRectResizeEnabled_; 67223b3eb3cSopenharmony_ci static FoldScreenType foldScreenType_; 67323b3eb3cSopenharmony_ci}; 67423b3eb3cSopenharmony_ci 67523b3eb3cSopenharmony_ci} // namespace OHOS::Ace 67623b3eb3cSopenharmony_ci 67723b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_FRAMEWORKS_BASE_UTILS_SYSTEM_PROPERTIES_H 678