1 /* 2 * Copyright (c) 2021-2024 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 #ifndef HIVIEW_OAL_SYSTEM_PROPERTY_H 16 #define HIVIEW_OAL_SYSTEM_PROPERTY_H 17 #include <cstdint> 18 #include <string> 19 namespace OHOS { 20 namespace HiviewDFX { 21 constexpr char KEY_BUILD_CHARACTER[] = "ro.build.characteristics"; 22 constexpr char KEY_HIVIEW_VERSION_TYPE[] = "const.logsystem.versiontype"; 23 constexpr char KEY_DEVELOPER_MODE_STATE[] = "const.security.developermode.state"; 24 constexpr char HIVIEW_UCOLLECTION_STATE[] = "hiviewdfx.ucollection.switchon"; 25 constexpr char HIVIEW_UCOLLECTION_TEST_APP_TRACE_STATE[] = "hiviewdfx.ucollection.testapptrace"; 26 constexpr char DEVELOP_HIVIEW_TRACE_RECORDER[] = "persist.hiview.trace_recorder"; 27 constexpr char KEY_LABORATORY_MODE_STATE[] = "persist.sys.hiview.testtype"; 28 constexpr char KEY_LEAKDECTOR_MODE_STATE[] = "persist.hiview.leak_detector"; 29 namespace Parameter { 30 std::string GetString(const std::string& key, const std::string& defaultValue); 31 int64_t GetInteger(const std::string& key, const int64_t defaultValue); 32 uint64_t GetUnsignedInteger(const std::string& key, const uint64_t defaultValue); 33 bool GetBoolean(const std::string& key, const bool defaultValue); 34 bool SetProperty(const std::string& key, const std::string& defaultValue); 35 int WaitParamSync(const char *key, const char *value, int timeout); 36 typedef void (*ParameterChgPtr)(const char *key, const char *value, void *context); 37 int WatchParamChange(const char *keyPrefix, ParameterChgPtr callback, void *context); 38 bool IsBetaVersion(); 39 bool IsDeveloperMode(); 40 bool IsUCollectionSwitchOn(); 41 bool IsTraceCollectionSwitchOn(); 42 bool IsLaboratoryMode(); 43 bool IsTestAppTraceOn(); 44 bool IsLeakStateMode(); 45 std::string GetDeviceTypeStr(); 46 std::string GetDisplayVersionStr(); 47 std::string GetBrandStr(); 48 std::string GetManufactureStr(); 49 std::string GetMarketNameStr(); 50 std::string GetDeviceModelStr(); 51 std::string GetSysVersionStr(); 52 std::string GetDistributionOsVersionStr(); 53 std::string GetProductModelStr(); 54 std::string GetSysVersionDetailsStr(); 55 std::string GetVersionStr(); 56 int32_t GetRegionCode(); 57 std::string GetPatchVersionStr(); 58 }; 59 } // namespace HiviewDFX 60 } // namespace OHOS 61 #endif // HIVIEW_OAL_SYSTEM_PROPERTY_H 62