检查设备通过亚行景观 [英] Check if device is landscape via ADB
问题描述
是否有可能通过ADB检查设备的方向?
Is it possible to check a devices orientation via ADB?
不受安装任何软件,调用任何现有的软件,只是通过亚洲开发银行。猜想有一个状态文件某处的/ proc
,但无法找到它。
Not by installing any software, calling any existing software, just through ADB. Would guess there is a status file somewhere in /proc
, but could not find it yet.
推荐答案
这可以通过以下命令来完成:
This can be done through the following command:
adb shell dumpsys | grep 'SurfaceOrientation' | awk '{ print $2 }'
的输出将是一个整数范围从0到3为四个可能的方位。 0和2是风景而1和3是人像。由于 dumpsys
输出是非常大的,该命令可能需要几秒钟才能完成。
The output will be an integer ranging from 0 to 3 for each of the four possible orientations. 0 and 2 are landscapes while 1 and 3 are portraits. As the dumpsys
output is very large, the command might take a few seconds to complete.
更新: dgmltn的修改可能要快得多:
Update: dgmltn's modification is likely much faster:
adb shell dumpsys input | grep 'SurfaceOrientation' | awk '{ print $2 }'
这篇关于检查设备通过亚行景观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!