I've got adb access to my android phone.

So I know that I can override screen density and screen resolution with the am command provided with Android. That's great and dandy, I guess. But is there a way to grab those two numbers from the command line? I know the pm utility can do some information gathering, most notably pm list features to see if the Android device has wireless, bluetooth, gps, etc. pm doesn't seem to do much more information reporting than this, though.

It would be helpful to know what versions of Android that the command is supported for. Ideally I would like something that works on Android 2.2+ (Froyo), but taking something that only works from 4.0.3+ (Ice Cream Sandwich) is fine too. I would also like it if there was a way to figure this out without root access.

I know that it's possible to get the screen resolution and density programmatically, as described in this question.


the result and precise format of the dumpsys command depends on the hardware vendor (of graphics chipset/driver and handset itself) but you should be able to find that info in the adb shell dumpsys display output

  • 5
    So I could call adb shell dumpsys display | grep mBaseDisplayInfo to get the appropriate information? It seems to match up, on my nexus 7 dumpsys reports the density to be 213 and the resolution to be 800x1280. It also reports information on rotation and such, neat. I didn't know dumpsys existed, but it seems to report on a lot of useful information as noted here: stackoverflow.com/questions/11201659/… Apr 26 '13 at 20:14
  • yes. the problem is that different phones could have a different format of this line
    – user23414
    Apr 26 '13 at 20:16
  • adb shell dumpsys display | grep mRequestedMode Then adb shell dumpsys display | grep mMode={id= to get the modeinfo Jun 20 '18 at 22:04

In Android versions equipped with wm tool, you can use the commands:

adb shell wm size      # shows the real size and current size
adb shell wm density   # shows the real density and current density

(Click image to enlarge)


I've tested successfully on stock Android 5.x and 6.x. Since wm tool comes with Android 4.3.x and 4.4.x as well, the solution may work on them as well.

  • Note: yes, the question restricts to now archaic Android version but the problem seems relevant for just any Android version. I decided to bring information not covered in accepted answer.
    – Firelord
    May 13 '16 at 6:20
  • Is this measurement in pixels? Apr 8 '19 at 14:28
  • @IgorGanapolsky that I do not know.
    – Firelord
    Apr 8 '19 at 15:38

If display service isn't available in dumpsys, you may look for line ro.sf.lcd_density= into /system/build.prop. To get it from phone:

adb pull /system/build.prop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.