未验证 提交 1360a2d7 编写于 作者: O openharmony_ci 提交者: Gitee

!1120 支持从devicetype获取设备类型

Merge pull request !1120 from cheng_jinsong/devicetype
...@@ -163,7 +163,10 @@ std::string GetDeviceType(void) ...@@ -163,7 +163,10 @@ std::string GetDeviceType(void)
{"fitnessWatch", "liteWearable"}, {"fitnessWatch", "liteWearable"},
}; };
static const char *productType = nullptr; static const char *productType = nullptr;
const char *type = GetProperty("const.build.characteristics", &productType); const char *type = GetProperty("const.build.devicetype", &productType);
if (type == nullptr) {
type = GetProperty("const.build.characteristics", &productType);
}
if (deviceTypeMap.count(type) != 0) { if (deviceTypeMap.count(type) != 0) {
return deviceTypeMap[type]; return deviceTypeMap[type];
} }
......
...@@ -94,6 +94,10 @@ int SetParameter(const char *key, const char *value) ...@@ -94,6 +94,10 @@ int SetParameter(const char *key, const char *value)
const char *GetDeviceType(void) const char *GetDeviceType(void)
{ {
static const char *productType = NULL; static const char *productType = NULL;
const char *deviceType = GetProperty("const.build.devicetype", &productType);
if (deviceType != NULL) {
return deviceType;
}
return GetProperty("const.build.characteristics", &productType); return GetProperty("const.build.characteristics", &productType);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册