adb shell wm 命令使用

1. 连接上设备,在控制台输入命令  adb shell wm help 

home@home-MS-7B89:~$ adb shell wm help

Window manager (window) commands:
  help
    Print this help text.
  s XXX 1 //or 0, true, false
    Set WindowManagerDebugConfig debug param to true/false.
  s debug_savestate 1 //or 0, true, false
    Set save WindowManagerDebugConfig debug state.
  s debug_liststate 1 //or 0, true, false
    List WindowManagerDebugConfig debug state.
  p XXX 1 //or 0, true, false
    Set PhoneWindowManager debug param to true/false.
  p debug_savestate 1 //or 0, true, false
    Set save PhoneWindowManager debug state.
  p debug_liststate 1 //or 0, true, false
    List PhoneWindowManager debug state.
  c windowName /data/misc/wmtrace/a.png
    capture the specific window's layer to bimmap
  size [reset|WxH|WdpxHdp]
    Return or override display size.
    width and height in pixels unless suffixed with 'dp'.
  density [reset|DENSITY]
    Return or override display density.
  overscan [reset|LEFT,TOP,RIGHT,BOTTOM]
    Set overscan area for display.
  scaling [off|auto]
    Set display scaling mode.
  dismiss-keyguard
    Dismiss the keyguard, prompting user for auth if necessary.
  folded-area [reset|LEFT,TOP,RIGHT,BOTTOM]
    Return or override folded area.
  set-user-rotation [free|lock] [-d DISPLAY_ID] [rotation]
    Set user rotation mode and user rotation.
  set-fix-to-user-rotation [-d DISPLAY_ID] [enabled|disabled]
    Enable or disable rotating display for app requested orientation.
  tracing (start | stop)
    Start or stop window tracing.

2. 上图是wm全部的命令, 我挑选工作中平时用的做解释说明

   1)  adb shell wm size  

         说明:查看屏幕的分辨率, 返回屏幕的宽高像素, 单位: px

adb shell wm size
Physical size: 1200x1920

    2) adb shell wm size 1080x1920

         说明: 自定义设置屏幕的分辨率 宽为1080px   高为1920px

adb shell wm size 1080x1920

Physical size: 1200x1920
Override size: 1080x1920

    3) adb shell wm size reset 

        说明:把自定义的屏幕分辨率设置参数  重置

    4) adb shell wm density

           说明: 查看设备屏幕密度

adb shell wm density
Physical density: 320

    5) adb shell  wm density 240

            说明: 自定义设置设备屏幕密度

adb shell wm density 240

Physical density: 320
Override density: 240

           同样 adb shell wm density reset 命令:  重置参数恢复默认

    6)adb shell wm overscan 

           说明: 设置显示区域大小 , 坐标值:依次为左、上、右、下

adb shell wm overscan 100,200,300,400

          同样 adb shell wm overscan reset :   重置参数恢复默认

       

     7)adb shell wm dismiss-keyguard

           说明: 前提没有设置数字,图案,PIN密码,如果是锁屏待机状态,执行此命令后,直接解锁进入桌面

     8)adb shell wm  c  xxx

            说明:将特定窗口的图层捕获为 bimmap,然后存到设备 /data/misc/wmtrace/a.png 此路径下

adb shell wm c dsf
use the default file path name /data/misc/wmtrace/a.png
WindowName = dsf
can not find the window dsf

后续再把工作中 adb shell  wm 用到的命令添加进来。

                

      

    

   

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值