• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 enum UserType: uint8_t {
31     USER_TYPE_CHINA_COMMERCIAL = 1,
32     USER_TYPE_CHINA_BETA = 3,
33     USER_TYPE_OVERSEA_BETA = 5,
34     USER_TYPE_OVERSEA_COMMERCIAL = 6
35 };
36 
37 std::string GetString(const std::string& key, const std::string& defaultValue);
38 int64_t GetInteger(const std::string& key, const int64_t defaultValue);
39 uint64_t GetUnsignedInteger(const std::string& key, const uint64_t defaultValue);
40 bool GetBoolean(const std::string& key, const bool defaultValue);
41 bool SetProperty(const std::string& key, const std::string& defaultValue);
42 int WaitParamSync(const char *key, const char *value, int timeout);
43 typedef void (*ParameterChgPtr)(const char *key, const char *value, void *context);
44 int WatchParamChange(const char *keyPrefix, ParameterChgPtr callback, void *context);
45 bool IsBetaVersion();
46 bool IsDeveloperMode();
47 bool IsOversea();
48 UserType GetUserType();
49 bool IsUCollectionSwitchOn();
50 bool IsTraceCollectionSwitchOn();
51 bool IsLaboratoryMode();
52 bool IsTestAppTraceOn();
53 bool IsLeakStateMode();
54 std::string GetDeviceTypeStr();
55 std::string GetDisplayVersionStr();
56 std::string GetBrandStr();
57 std::string GetManufactureStr();
58 std::string GetMarketNameStr();
59 std::string GetDeviceModelStr();
60 std::string GetSysVersionStr();
61 std::string GetDistributionOsVersionStr();
62 std::string GetProductModelStr();
63 std::string GetSysVersionDetailsStr();
64 std::string GetVersionTypeStr();
65 std::string GetPatchVersionStr();
66 };
67 } // namespace HiviewDFX
68 } // namespace OHOS
69 #endif // HIVIEW_OAL_SYSTEM_PROPERTY_H
70