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