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#include "test/mock/base/mock_system_properties.h" 1723b3eb3cSopenharmony_ci 1823b3eb3cSopenharmony_ci#include <string> 1923b3eb3cSopenharmony_ci 2023b3eb3cSopenharmony_ci#include "base/utils/system_properties.h" 2123b3eb3cSopenharmony_ci 2223b3eb3cSopenharmony_cinamespace OHOS::Ace { 2323b3eb3cSopenharmony_cinamespace { 2423b3eb3cSopenharmony_ciconstexpr int32_t ORIENTATION_PORTRAIT = 0; 2523b3eb3cSopenharmony_ciconstexpr int32_t ORIENTATION_LANDSCAPE = 1; 2623b3eb3cSopenharmony_ci 2723b3eb3cSopenharmony_civoid Swap(int32_t& deviceWidth, int32_t& deviceHeight) 2823b3eb3cSopenharmony_ci{ 2923b3eb3cSopenharmony_ci int32_t temp = deviceWidth; 3023b3eb3cSopenharmony_ci deviceWidth = deviceHeight; 3123b3eb3cSopenharmony_ci deviceHeight = temp; 3223b3eb3cSopenharmony_ci} 3323b3eb3cSopenharmony_ci} // namespace 3423b3eb3cSopenharmony_ci 3523b3eb3cSopenharmony_ciDeviceType SystemProperties::deviceType_ = DeviceType::PHONE; 3623b3eb3cSopenharmony_ciDeviceOrientation SystemProperties::orientation_ { DeviceOrientation::PORTRAIT }; 3723b3eb3cSopenharmony_cibool SystemProperties::isHookModeEnabled_ = false; 3823b3eb3cSopenharmony_cibool SystemProperties::rosenBackendEnabled_ = true; 3923b3eb3cSopenharmony_cibool SystemProperties::windowAnimationEnabled_ = true; 4023b3eb3cSopenharmony_cistd::atomic<bool> SystemProperties::layoutTraceEnable_(false); 4123b3eb3cSopenharmony_cistd::atomic<bool> SystemProperties::traceInputEventEnable_(false); 4223b3eb3cSopenharmony_cibool SystemProperties::buildTraceEnable_ = false; 4323b3eb3cSopenharmony_cibool SystemProperties::syncDebugTraceEnable_ = false; 4423b3eb3cSopenharmony_cibool SystemProperties::pixelRoundEnable_ = true; 4523b3eb3cSopenharmony_cibool SystemProperties::textTraceEnable_ = false; 4623b3eb3cSopenharmony_cibool SystemProperties::syntaxTraceEnable_ = false; 4723b3eb3cSopenharmony_cidouble SystemProperties::resolution_ = 0.0; 4823b3eb3cSopenharmony_ciconstexpr float defaultAnimationScale = 1.0f; 4923b3eb3cSopenharmony_cibool SystemProperties::extSurfaceEnabled_ = false; 5023b3eb3cSopenharmony_ciuint32_t SystemProperties::dumpFrameCount_ = 0; 5123b3eb3cSopenharmony_cibool SystemProperties::debugEnabled_ = false; 5223b3eb3cSopenharmony_cibool SystemProperties::layoutDetectEnabled_ = false; 5323b3eb3cSopenharmony_ciColorMode SystemProperties::colorMode_ { ColorMode::LIGHT }; 5423b3eb3cSopenharmony_ciint32_t SystemProperties::deviceWidth_ = 720; 5523b3eb3cSopenharmony_ciint32_t SystemProperties::deviceHeight_ = 1280; 5623b3eb3cSopenharmony_cibool SystemProperties::debugOffsetLogEnabled_ = false; 5723b3eb3cSopenharmony_cibool SystemProperties::downloadByNetworkEnabled_ = false; 5823b3eb3cSopenharmony_ciint32_t SystemProperties::devicePhysicalWidth_ = 0; 5923b3eb3cSopenharmony_ciint32_t SystemProperties::devicePhysicalHeight_ = 0; 6023b3eb3cSopenharmony_cibool SystemProperties::enableScrollableItemPool_ = false; 6123b3eb3cSopenharmony_cibool SystemProperties::navigationBlurEnabled_ = false; 6223b3eb3cSopenharmony_cibool SystemProperties::gridCacheEnabled_ = true; 6323b3eb3cSopenharmony_cibool SystemProperties::sideBarContainerBlurEnable_ = false; 6423b3eb3cSopenharmony_cistd::atomic<bool> SystemProperties::stateManagerEnable_(false); 6523b3eb3cSopenharmony_cistd::atomic<bool> SystemProperties::acePerformanceMonitorEnable_(false); 6623b3eb3cSopenharmony_cibool SystemProperties::aceCommercialLogEnable_ = false; 6723b3eb3cSopenharmony_cistd::atomic<bool> SystemProperties::debugBoundaryEnabled_(false); 6823b3eb3cSopenharmony_cibool SystemProperties::developerModeOn_ = false; 6923b3eb3cSopenharmony_cibool SystemProperties::faultInjectEnabled_ = false; 7023b3eb3cSopenharmony_cibool SystemProperties::imageFileCacheConvertAstc_ = true; 7123b3eb3cSopenharmony_cibool SystemProperties::imageFrameworkEnable_ = true; 7223b3eb3cSopenharmony_cibool SystemProperties::debugAutoUIEnabled_ = false; 7323b3eb3cSopenharmony_cifloat SystemProperties::dragStartDampingRatio_ = 0.2f; 7423b3eb3cSopenharmony_cifloat SystemProperties::dragStartPanDisThreshold_ = 10.0f; 7523b3eb3cSopenharmony_cistd::pair<float, float> SystemProperties::brightUpPercent_ = {}; 7623b3eb3cSopenharmony_ciint32_t SystemProperties::imageFileCacheConvertAstcThreshold_ = 3; 7723b3eb3cSopenharmony_ci 7823b3eb3cSopenharmony_cibool g_irregularGrid = true; 7923b3eb3cSopenharmony_cibool g_segmentedWaterflow = true; 8023b3eb3cSopenharmony_ci 8123b3eb3cSopenharmony_cifloat SystemProperties::GetFontWeightScale() 8223b3eb3cSopenharmony_ci{ 8323b3eb3cSopenharmony_ci // Default value of font weight scale is 1.0. 8423b3eb3cSopenharmony_ci return 1.0f; 8523b3eb3cSopenharmony_ci} 8623b3eb3cSopenharmony_ci 8723b3eb3cSopenharmony_ciDeviceType SystemProperties::GetDeviceType() 8823b3eb3cSopenharmony_ci{ 8923b3eb3cSopenharmony_ci return deviceType_; 9023b3eb3cSopenharmony_ci} 9123b3eb3cSopenharmony_ci 9223b3eb3cSopenharmony_cibool SystemProperties::GetDebugEnabled() 9323b3eb3cSopenharmony_ci{ 9423b3eb3cSopenharmony_ci return debugEnabled_; 9523b3eb3cSopenharmony_ci} 9623b3eb3cSopenharmony_ci 9723b3eb3cSopenharmony_cibool SystemProperties::GetLayoutDetectEnabled() 9823b3eb3cSopenharmony_ci{ 9923b3eb3cSopenharmony_ci return layoutDetectEnabled_; 10023b3eb3cSopenharmony_ci} 10123b3eb3cSopenharmony_ci 10223b3eb3cSopenharmony_cifloat SystemProperties::GetAnimationScale() 10323b3eb3cSopenharmony_ci{ 10423b3eb3cSopenharmony_ci return defaultAnimationScale; 10523b3eb3cSopenharmony_ci} 10623b3eb3cSopenharmony_ci 10723b3eb3cSopenharmony_cibool SystemProperties::GetIsUseMemoryMonitor() 10823b3eb3cSopenharmony_ci{ 10923b3eb3cSopenharmony_ci return false; 11023b3eb3cSopenharmony_ci} 11123b3eb3cSopenharmony_ci 11223b3eb3cSopenharmony_cibool SystemProperties::IsOpIncEnable() 11323b3eb3cSopenharmony_ci{ 11423b3eb3cSopenharmony_ci return true; 11523b3eb3cSopenharmony_ci} 11623b3eb3cSopenharmony_ci 11723b3eb3cSopenharmony_civoid SystemProperties::SetDeviceOrientation(int32_t orientation) 11823b3eb3cSopenharmony_ci{ 11923b3eb3cSopenharmony_ci if (orientation == ORIENTATION_PORTRAIT && orientation_ != DeviceOrientation::PORTRAIT) { 12023b3eb3cSopenharmony_ci Swap(deviceWidth_, deviceHeight_); 12123b3eb3cSopenharmony_ci orientation_ = DeviceOrientation::PORTRAIT; 12223b3eb3cSopenharmony_ci } else if (orientation == ORIENTATION_LANDSCAPE && orientation_ != DeviceOrientation::LANDSCAPE) { 12323b3eb3cSopenharmony_ci Swap(deviceWidth_, deviceHeight_); 12423b3eb3cSopenharmony_ci orientation_ = DeviceOrientation::LANDSCAPE; 12523b3eb3cSopenharmony_ci } 12623b3eb3cSopenharmony_ci} 12723b3eb3cSopenharmony_ci 12823b3eb3cSopenharmony_cibool SystemProperties::Is24HourClock() 12923b3eb3cSopenharmony_ci{ 13023b3eb3cSopenharmony_ci return false; 13123b3eb3cSopenharmony_ci} 13223b3eb3cSopenharmony_ci 13323b3eb3cSopenharmony_cibool SystemProperties::GetTitleStyleEnabled() 13423b3eb3cSopenharmony_ci{ 13523b3eb3cSopenharmony_ci return false; 13623b3eb3cSopenharmony_ci} 13723b3eb3cSopenharmony_ci 13823b3eb3cSopenharmony_cistd::string SystemProperties::GetCustomTitleFilePath() 13923b3eb3cSopenharmony_ci{ 14023b3eb3cSopenharmony_ci return {}; 14123b3eb3cSopenharmony_ci} 14223b3eb3cSopenharmony_ci 14323b3eb3cSopenharmony_cibool SystemProperties::GetDisplaySyncSkipEnabled() 14423b3eb3cSopenharmony_ci{ 14523b3eb3cSopenharmony_ci return true; 14623b3eb3cSopenharmony_ci} 14723b3eb3cSopenharmony_ci 14823b3eb3cSopenharmony_cibool SystemProperties::GetNavigationBlurEnabled() 14923b3eb3cSopenharmony_ci{ 15023b3eb3cSopenharmony_ci return navigationBlurEnabled_; 15123b3eb3cSopenharmony_ci} 15223b3eb3cSopenharmony_ci 15323b3eb3cSopenharmony_cibool SystemProperties::GetGridCacheEnabled() 15423b3eb3cSopenharmony_ci{ 15523b3eb3cSopenharmony_ci return gridCacheEnabled_; 15623b3eb3cSopenharmony_ci} 15723b3eb3cSopenharmony_ci 15823b3eb3cSopenharmony_cibool SystemProperties::GetGridIrregularLayoutEnabled() 15923b3eb3cSopenharmony_ci{ 16023b3eb3cSopenharmony_ci return g_irregularGrid; 16123b3eb3cSopenharmony_ci} 16223b3eb3cSopenharmony_ci 16323b3eb3cSopenharmony_cibool SystemProperties::WaterFlowUseSegmentedLayout() 16423b3eb3cSopenharmony_ci{ 16523b3eb3cSopenharmony_ci return g_segmentedWaterflow; 16623b3eb3cSopenharmony_ci} 16723b3eb3cSopenharmony_ci 16823b3eb3cSopenharmony_cibool SystemProperties::GetSideBarContainerBlurEnable() 16923b3eb3cSopenharmony_ci{ 17023b3eb3cSopenharmony_ci return sideBarContainerBlurEnable_; 17123b3eb3cSopenharmony_ci} 17223b3eb3cSopenharmony_ci 17323b3eb3cSopenharmony_cifloat SystemProperties::GetDefaultResolution() 17423b3eb3cSopenharmony_ci{ 17523b3eb3cSopenharmony_ci return 1.0f; 17623b3eb3cSopenharmony_ci} 17723b3eb3cSopenharmony_ci 17823b3eb3cSopenharmony_cistd::string SystemProperties::GetAtomicServiceBundleName() 17923b3eb3cSopenharmony_ci{ 18023b3eb3cSopenharmony_ci return {}; 18123b3eb3cSopenharmony_ci} 18223b3eb3cSopenharmony_ci 18323b3eb3cSopenharmony_cifloat SystemProperties::GetDragStartDampingRatio() 18423b3eb3cSopenharmony_ci{ 18523b3eb3cSopenharmony_ci return dragStartDampingRatio_; 18623b3eb3cSopenharmony_ci} 18723b3eb3cSopenharmony_ci 18823b3eb3cSopenharmony_cifloat SystemProperties::GetDragStartPanDistanceThreshold() 18923b3eb3cSopenharmony_ci{ 19023b3eb3cSopenharmony_ci return dragStartPanDisThreshold_; 19123b3eb3cSopenharmony_ci} 19223b3eb3cSopenharmony_ci 19323b3eb3cSopenharmony_cibool SystemProperties::GetAllowWindowOpenMethodEnabled() 19423b3eb3cSopenharmony_ci{ 19523b3eb3cSopenharmony_ci return false; 19623b3eb3cSopenharmony_ci} 19723b3eb3cSopenharmony_ci 19823b3eb3cSopenharmony_cibool SystemProperties::IsSmallFoldProduct() 19923b3eb3cSopenharmony_ci{ 20023b3eb3cSopenharmony_ci return false; 20123b3eb3cSopenharmony_ci} 20223b3eb3cSopenharmony_ci 20323b3eb3cSopenharmony_cistd::string SystemProperties::GetDebugInspectorId() 20423b3eb3cSopenharmony_ci{ 20523b3eb3cSopenharmony_ci return "N/A"; 20623b3eb3cSopenharmony_ci} 20723b3eb3cSopenharmony_ci 20823b3eb3cSopenharmony_cidouble SystemProperties::GetSrollableVelocityScale() 20923b3eb3cSopenharmony_ci{ 21023b3eb3cSopenharmony_ci return 0.0; 21123b3eb3cSopenharmony_ci} 21223b3eb3cSopenharmony_ci 21323b3eb3cSopenharmony_cidouble SystemProperties::GetSrollableFriction() 21423b3eb3cSopenharmony_ci{ 21523b3eb3cSopenharmony_ci return 0.0; 21623b3eb3cSopenharmony_ci} 21723b3eb3cSopenharmony_ci} // namespace OHOS::Ace 218