Skip to content

Commit

Permalink
adapt screen density key to ro.sf.lcd_density and express screen dens…
Browse files Browse the repository at this point in the history
…ity to one decimal places

Signed-off-by: wenlingyun1 <wenlingyun1@xiaomi.com>
  • Loading branch information
WenLY1 committed Feb 20, 2025
1 parent e67b7df commit fc7561b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/uv_devinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define CONFIG_DEVICE_MANUFACTURER_KEY "ro.product.manufacturer"
#define CONFIG_DEVICE_DEVICETYPE_KEY "ro.product.device.devicetype"
#define CONFIG_DEVICE_SCREENSHAPE_KEY "ro.product.device.screenshape"
#define CONFIG_DEVICE_SCREENDENSITY_KEY "ro.product.device.screendensity"
#define CONFIG_DEVICE_SCREENDENSITY_KEY "ro.sf.lcd_density"
#define CONFIG_DEVICE_LANGUAGE_KEY "ro.system.language"
#define CONFIG_DEVICE_REGION_KEY "ro.system.region"
#define CONFIG_DEVICE_OSVERSIONCODE_KEY "ro.system.osversioncode"
Expand Down Expand Up @@ -313,8 +313,8 @@ int uv_getdeviceinfo(uv_devinfo_t* info)

info->osversioncode = property_get_int32(CONFIG_DEVICE_OSVERSIONCODE_KEY, CONFIG_VERSION);

property_get(CONFIG_DEVICE_SCREENDENSITY_KEY, kvbuf, "1.0");
info->screendensity = atof(kvbuf);
property_get(CONFIG_DEVICE_SCREENDENSITY_KEY, kvbuf, "160.0");
info->screendensity = (int)((atof(kvbuf) / 16.0 + 0.5)) / 10.0;

DEVICE_PROPERTY_GET(CONFIG_DEVICE_SCREENSHAPE_KEY, info->screenshape, "unknown");
DEVICE_PROPERTY_GET(CONFIG_DEVICE_DEVICETYPE_KEY, info->devicetype, "unknown");
Expand Down Expand Up @@ -372,4 +372,4 @@ int uv_getdeviceinfo(uv_devinfo_t* info)

#endif
return ret;
}
}

0 comments on commit fc7561b

Please sign in to comment.