• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 SYSTEM_PROPERTIES_ADAPTER_H
17 #define SYSTEM_PROPERTIES_ADAPTER_H
18 
19 #include <cstdint>
20 #include <string>
21 #include <vector>
22 
23 namespace OHOS::NWeb {
24 
25 struct FrameRateSetting;
26 
27 enum class ProductDeviceType : int32_t {
28     DEVICE_TYPE_MOBILE,
29     DEVICE_TYPE_TABLET,
30     DEVICE_TYPE_2IN1,
31     DEVICE_TYPE_WEARABLE,
32     DEVICE_TYPE_TV,
33     DEVICE_TYPE_UNKNOWN
34 };
35 
36 enum class PropertiesKey : int32_t { PROP_RENDER_DUMP, PROP_DEBUG_TRACE };
37 
38 class SystemPropertiesObserver {
39 public:
40     SystemPropertiesObserver() = default;
41 
42     virtual ~SystemPropertiesObserver() = default;
43 
44     virtual void PropertiesUpdate(const char* value) = 0;
45 };
46 
47 class SystemPropertiesAdapter {
48 public:
49     SystemPropertiesAdapter() = default;
50 
51     virtual ~SystemPropertiesAdapter() = default;
52 
53     virtual bool GetResourceUseHapPathEnable() = 0;
54 
55     virtual std::string GetDeviceInfoProductModel() = 0;
56 
57     virtual std::string GetDeviceInfoBrand() = 0;
58 
59     virtual int32_t GetDeviceInfoMajorVersion() = 0;
60 
61     virtual ProductDeviceType GetProductDeviceType() = 0;
62 
63     virtual bool GetWebOptimizationValue() = 0;
64 
65     virtual bool IsAdvancedSecurityMode() = 0;
66 
67     virtual std::string GetUserAgentOSName() = 0;
68 
69     virtual int32_t GetSoftwareMajorVersion() = 0;
70 
71     virtual int32_t GetSoftwareSeniorVersion() = 0;
72 
73     virtual std::string GetNetlogMode() = 0;
74 
75     virtual bool GetTraceDebugEnable() = 0;
76 
77     virtual std::string GetSiteIsolationMode() = 0;
78 
79     virtual int32_t GetFlowBufMaxFd() = 0;
80 
81     virtual bool GetOOPGPUEnable() = 0;
82 
83     virtual void SetOOPGPUDisable() = 0;
84 
85     virtual void AttachSysPropObserver(PropertiesKey key, SystemPropertiesObserver* observer) = 0;
86 
87     virtual void DetachSysPropObserver(PropertiesKey key, SystemPropertiesObserver* observer) = 0;
88 
89     virtual bool GetBoolParameter(const std::string& key, bool defaultValue) = 0;
90 
91     virtual std::vector<FrameRateSetting> GetLTPOConfig(const std::string& settingName) = 0;
92 
93     virtual std::string GetOOPGPUStatus() = 0;
94 
95     virtual bool IsLTPODynamicApp(const std::string& bundleName) = 0;
96 
97     virtual int32_t GetLTPOStrategy() = 0;
98 
99     virtual std::string GetUserAgentBaseOSName() = 0;
100 
101     virtual std::string GetUserAgentOSVersion() = 0;
102 
103     virtual std::string GetVulkanStatus() = 0;
104 
105     virtual std::string GetCompatibleDeviceType() = 0;
106 
107     virtual std::string GetDeviceInfoApiVersion() = 0;
108 
109     virtual std::string GetPRPPreloadMode() = 0;
110 
111     virtual std::string GetScrollVelocityScale() = 0;
112 
113     virtual std::string GetScrollFriction() = 0;
114 
115     virtual std::string GetBundleName() = 0;
116 };
117 
118 } // namespace OHOS::NWeb
119 
120 #endif // SYSTEM_PROPERTIES_ADAPTER_H
121