I am trying to understand DisplayMetrics.DENSITY_DEVICE_STABLE
property on Android.
From Android 10 Compatibility Definition (and Android 7 Compatibility Definition):
[C-0-1] By default, device implementations MUST report only one of the Android framework densities that are listed on DisplayMetrics through the DENSITY_DEVICE_STABLE API and this value MUST NOT change at any time; however, the device MAY report a different arbitrary density according to the display configuration changes made by the user (for example, display size) set after initial boot.
Link: https://source.android.com/compatibility/android-cdd#7_1_1_3_screen_density
From my research, I found that on most devices, DisplayMetrics.DENSITY_DEVICE_STABLE
is equal to the resources.displayMetrics.densityDpi
when the screen zoom/display size is set to normal.
However on Samsung S10+ running Android 10 the DisplayMetrics.DENSITY_DEVICE_STABLE
is 420, while the resources.displayMetrics.densityDpi
is 640 with screen zoom set to normal.
I also, tested that on Samsung S8 running Android 8 and found that DisplayMetrics.DENSITY_DEVICE_STABLE
is equal to the resources.displayMetrics.densityDpi
with screen zoom set to default (it is 480).
So my question is: Should DisplayMetrics.DENSITY_DEVICE_STABLE
be the same as resources.displayMetrics.densityDpi
at default screen zoom.
Thank you
The DisplayMetrics.DENSITY_DEVICE_STABLE
on Samsung S10+ devices corresponds to the resources.displayMetrics.densityDpi
when the device is in FHD+ resolution and min display zoom.
It appears that when the device's resolution is changed from the default it impacts the resources.displayMetrics.densityDpi
and the DisplayMetrics.DENSITY_DEVICE_STABLE
property can no longer be safely compared to resources.displayMetrics.densityDpi
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With