Adb Command to display size and density with devices running on version 4.2 or less not giving any result

时间:2016-05-17 11:07:34

标签: android adb

I am using android device with version 4.1.2 and aware of the fact that with the version below 4.3 has display size and density in am (Activity Manager) instead of wm (Windows Manager). We can also find it by using 'dumpsys' in some the devices by-

adb shell dumpsys display

But for the device I am using, it says-

Can't find service: display

And when I am checking the list of services for the devices by-

adb shell service list

It's showing display service is present as-

display.hwcservice: [android.display.IHWComposer]

But this service is giving no output. Also by using am commands which is-

adb shell am display size <resolution>

We can only customize the resolution, but can't get the current resolution.

For devices running on version 4.3 or above, it can be determined by using-

adb shell wm size
adb shell wm density

Is there any other way to find out display size and density for devices running on 4.2 or less?

2 个答案:

答案 0 :(得分:6)

adb shell dumpsys window | grep cur= |tr -s " " | cut -d " " -f 4|cut -d "=" -f 2

答案 1 :(得分:1)

You can try using dumpsys as-

adb shell dumpsys display

You can refer - dumpsys illustration