Display density on Android

By | 2 Dec 2015

Methods

Android supports changing the display resolution in 2 different ways.

wm density

This method works without root and changes the density of the window manager. You can call this command only from the adb shell.

The syntax is:

wm density [ppi]

E.g. the Nexus 9 has a real display density of 288ppi, so you would run:

wm density 288

To reset the value to the factory setting (for the N9 that is 320), just run:

wm density reset

build.prop

The other way to change the display density is to edit the build.prop. This only works with root access.

To edit the file, first make the system partition writable by remounting it.

Then find the file /system/build.prop and open it in a text editor. I use my favourite file manager FX File Explorer with its integrated editor for that.

Find the following line (Example from Nexus 9 with currently 320ppi):

ro.sf.lcd_density=320

And change the number to your desired value. BE SURE TO NOT CHANGE ANYTHING ELSE. Save the file and reboot your device.

Advantages

Setting the correct density value makes the display appear sharper and it may even make your device run better.

Android knows different densities and if an app supplies graphics in different qualities, it loads them according to the detected density. This means: The higher the density, the larger graphics Android has to load and keep in memory. So reducing the density (to the real value) can make Android load a bit less detailed graphics and thus save RAM.

Android knows these quality classes:

ClassPPI
ldpi100-140
mdpi141-199
hdpi200-319
xhdpi320-340
xxhdpi~480
xxxhdpi~640

As you can see, the 320ppi of the Nexus 9 makes Android use xhdpi resources. If you change the density to 318, you won’t notice anything, but Android will suddenly use the hdpi resources and save memory when running apps.

Problems

If you don’t have root access and try to change the density using the wm density command only, it might seem to work on the first glance, but you will notice strange effects.

If you’re using SwiftKey, you’ll notice it right away:

Other problems are more subtle (Nexus 9 at 288ppi):

Compare this to the same screen at the original 320ppi:

(If you’re still searching: Notice the huge “chevron” icon after the developer’s name. And also the huge background image.)

More info at the xda forum.

Leave a Reply