1 /*
2 * Copyright (c) 2021-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 #include "base/log/ace_checker.h"
17 #include "base/log/ace_performance_check.h"
18 #include "base/utils/system_properties.h"
19 #include "bridge/common/utils/engine_helper.h"
20
21 namespace OHOS::Ace {
22 DeviceType SystemProperties::deviceType_ = DeviceType::PHONE;
23 DeviceOrientation SystemProperties::orientation_ { DeviceOrientation::PORTRAIT };
24 bool SystemProperties::isHookModeEnabled_ = false;
25 bool SystemProperties::rosenBackendEnabled_ = true;
26 bool SystemProperties::windowAnimationEnabled_ = true;
27 double SystemProperties::resolution_ = 0.0;
28 constexpr float defaultAnimationScale = 1.0f;
29 bool SystemProperties::extSurfaceEnabled_ = false;
30 uint32_t SystemProperties::dumpFrameCount_ = 0;
31
32 int32_t AceChecker::pageNodes_ = 0;
33 int32_t AceChecker::pageDepth_ = 0;
34 int32_t AceChecker::nodeChildren_ = 0;
35 int32_t AceChecker::functionTimeout_ = 0;
36 int32_t AceChecker::vsyncTimeout_ = 0;
37 int32_t AceChecker::nodeTimeout_ = 0;
38 int32_t AceChecker::foreachItems_ = 0;
39 int32_t AceChecker::flexLayouts_ = 0;
40
41 // =================================================================================
42 // resolve compile error temporarily and wait
43 // for unittest cases to be integrated and modified
ScopedDelegate(const RefPtr<Framework::FrontendDelegate> & delegate,int32_t id)44 ScopedDelegate::ScopedDelegate(const RefPtr<Framework::FrontendDelegate>& delegate, int32_t id)
45 : delegate_(delegate), scope_(new ContainerScope(id))
46 {}
47
~ScopedDelegate()48 ScopedDelegate::~ScopedDelegate()
49 {
50 delete scope_;
51 scope_ = nullptr;
52 }
53
GetPositionOnJsCode()54 std::pair<int32_t, int32_t> EngineHelper::GetPositionOnJsCode()
55 {
56 return { 0, 0 };
57 }
58
GetCurrentDelegate()59 ScopedDelegate EngineHelper::GetCurrentDelegate()
60 {
61 return { nullptr, 0 };
62 }
63
RecordPerformanceCheckData(const PerformanceCheckNodeMap & nodeMap,int64_t vsyncTimeout)64 void AceScopedPerformanceCheck::RecordPerformanceCheckData(const PerformanceCheckNodeMap& nodeMap, int64_t vsyncTimeout)
65 {}
66
AceScopedPerformanceCheck(const std::string &)67 AceScopedPerformanceCheck::AceScopedPerformanceCheck(const std::string& /* name */) {}
68
~AceScopedPerformanceCheck()69 AceScopedPerformanceCheck::~AceScopedPerformanceCheck() {}
70
IsPerformanceCheckEnabled()71 bool AceChecker::IsPerformanceCheckEnabled()
72 {
73 return false;
74 }
75
NotifyCaution(const std::string & tag)76 void AceChecker::NotifyCaution(const std::string& tag) {}
77
InitPerformanceParameters()78 void AceChecker::InitPerformanceParameters() {}
79 // =================================================================================
80
GetFontWeightScale()81 float SystemProperties::GetFontWeightScale()
82 {
83 // Default value of font weight scale is 1.0.
84 return 1.0f;
85 }
86
GetDeviceType()87 DeviceType SystemProperties::GetDeviceType()
88 {
89 return deviceType_;
90 }
91
GetDebugEnabled()92 bool SystemProperties::GetDebugEnabled()
93 {
94 return false;
95 }
96
GetAnimationScale()97 float SystemProperties::GetAnimationScale()
98 {
99 return defaultAnimationScale;
100 }
101
GetIsUseMemoryMonitor()102 bool SystemProperties::GetIsUseMemoryMonitor()
103 {
104 return false;
105 }
106
107 } // namespace OHOS::Ace
108