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 namespace OHOS::NWeb { 22 23 struct FrameRateSetting; 24 25 enum class ProductDeviceType : int32_t { 26 DEVICE_TYPE_MOBILE, 27 DEVICE_TYPE_TABLET, 28 DEVICE_TYPE_2IN1, 29 DEVICE_TYPE_UNKNOWN 30 }; 31 32 enum class PropertiesKey : int32_t { PROP_RENDER_DUMP, PROP_DEBUG_TRACE, PROP_HITRACE_ENABLEFLAGS}; 33 34 class SystemPropertiesObserver { 35 public: 36 SystemPropertiesObserver() = default; 37 38 virtual ~SystemPropertiesObserver() = default; 39 40 virtual void PropertiesUpdate(const char* value) = 0; 41 }; 42 43 class SystemPropertiesAdapter { 44 public: 45 SystemPropertiesAdapter() = default; 46 47 virtual ~SystemPropertiesAdapter() = default; 48 49 virtual bool GetResourceUseHapPathEnable() = 0; 50 51 virtual std::string GetDeviceInfoProductModel() = 0; 52 53 virtual std::string GetDeviceInfoBrand() = 0; 54 55 virtual int32_t GetDeviceInfoMajorVersion() = 0; 56 57 virtual ProductDeviceType GetProductDeviceType() = 0; 58 59 virtual bool GetWebOptimizationValue() = 0; 60 61 virtual bool IsAdvancedSecurityMode() = 0; 62 63 virtual std::string GetUserAgentOSName() = 0; 64 65 virtual int32_t GetSoftwareMajorVersion() = 0; 66 67 virtual int32_t GetSoftwareSeniorVersion() = 0; 68 69 virtual std::string GetNetlogMode() = 0; 70 71 virtual bool GetTraceDebugEnable() = 0; 72 73 virtual std::string GetSiteIsolationMode() = 0; 74 75 virtual int32_t GetFlowBufMaxFd() = 0; 76 77 virtual bool GetOOPGPUEnable() = 0; 78 79 virtual void SetOOPGPUDisable() = 0; 80 81 virtual void AttachSysPropObserver(PropertiesKey key, SystemPropertiesObserver* observer) = 0; 82 83 virtual void DetachSysPropObserver(PropertiesKey key, SystemPropertiesObserver* observer) = 0; 84 85 virtual bool GetBoolParameter(const std::string& key, bool defaultValue) = 0; 86 87 virtual std::vector<FrameRateSetting> GetLTPOConfig(const std::string& settingName) = 0; 88 89 virtual std::string GetOOPGPUStatus() = 0; 90 91 virtual std::string GetUserAgentBaseOSName() = 0; 92 93 virtual std::string GetUserAgentOSVersion() = 0; 94 }; 95 96 } // namespace OHOS::NWeb 97 98 #endif // SYSTEM_PROPERTIES_ADAPTER_H 99