在 4.2 或更低版本上使用设备 运行 显示大小和密度的 Adb 命令未给出任何结果

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

我使用的是 android 版本为 4.1.2 的设备,我知道低于 4.3 的版本在 am(Activity 管理器)而不是 wm(Windows经理)。我们也可以通过在某些设备中使用 'dumpsys' 来找到它 -

adb shell dumpsys display

但是对于我使用的设备,它说-

Can't find service: display

当我检查设备的服务列表时-

adb shell service list

它显示显示服务作为-

存在
display.hwcservice: [android.display.IHWComposer]

但是这个服务没有输出。 也通过使用 am 命令,即 -

adb shell am display size <resolution>

只能自定义分辨率,无法获取当前分辨率

对于 4.3 或更高版本的设备 运行,可以使用 -

来确定
adb shell wm size
adb shell wm density

是否有任何其他方法可以找出设备 运行 4.2 或更低版本的显示尺寸和密度?

您可以尝试使用 dumpsys 作为-

adb shell dumpsys display

可以参考- dumpsys illustration

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