【Android】【多屏】多屏异显异触调试技巧总结

这里写目录标题

如何获取多屏IDs

bash 复制代码
dumpsys display | grep mDisplayId

trinket:/ # dumpsys display | grep mDisplayId
    mDisplayId=0
    mDisplayId=2
trinket:/ #

获取多屏的size/density

bash 复制代码
trinket:/ # wm
Window manager (window) commands:
  help
      Print this help text.
  size [reset|WxH|WdpxHdp] [-d DISPLAY_ID]
    Return or override display size.
    width and height in pixels unless suffixed with 'dp'.
  density [reset|DENSITY] [-d DISPLAY_ID]
    Return or override display density.
  folded-area [reset|LEFT,TOP,RIGHT,BOTTOM]
    Return or override folded area.
  overscan [reset|LEFT,TOP,RIGHT,BOTTOM] [-d DISPLAY ID]
    Set overscan area for display.
  scaling [off|auto] [-d DISPLAY_ID]
    Set display scaling mode.
  dismiss-keyguard
    Dismiss the keyguard, prompting user for auth if necessary.
  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.

通过指令 wm size -d xxx; // xxx 代表ID

bash 复制代码
trinket:/ # wm size -d 0
Physical size: 1080x1920
trinket:/ # wm size -d 2
Physical size: 1280x720
trinket:/ #

通过指令 wm density -d xxx; // xxx 代表ID

bash 复制代码
trinket:/ # wm density -d 0
Physical density: 320
Override density: 240
trinket:/ # wm density -d 2
Physical density: 213

如何启动应用到指定DisplayId

bash 复制代码
am start -n com.android.settings/.Settings --display 2

多屏截屏/录屏

screencap
bash 复制代码
trinket:/ # screencap  -h
usage: screencap [-hp] [-d display-id] [FILENAME]
   -h: this message
   -p: save the file as a png.
   -d: specify the physical display ID to capture (default: 19260879647709569)
       see "dumpsys SurfaceFlinger --display-id" for valid display IDs.
If FILENAME ends with .png it will be saved as a png.
If FILENAME is not given, the results will be printed to stdout.

指令如下:

bash 复制代码
//display id 0,界面截屏
screencap -p -d 0 sdcard/0.png
//display id 2,界面截屏
screencap -p -d 2 sdcard/2.png
screenrecord

当前android平台没有指令支持。

发送按键到指定DisplayId
bash 复制代码
//发送 back 按键到display id 2
input -d 2 keyevent 4

//发送屏幕点击事件
input -d 2 tap 200 200 

//发送屏幕滑动事件
//swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
input -d 2 siwpe 200 200 200 500 40
相关推荐
蓝速科技12 小时前
政务自助终端信创选型与无人值守落地方案
android·大数据·数据库·人工智能·科技·技术分享·政务
硫酸锌0113 小时前
在手机上运行Python增量备份手机数据到PC电脑
android·windows·python
hai_android14 小时前
子 View 被压小时,如何向父容器"告状"?——MEASURED_STATE_TOO_SMALL 向上传递机制
android·kotlin·android jetpack
AFinalStone14 小时前
Android 7 多用户源码解析(七)系统服务的多用户感知处理
android·系统架构·多用户
怪奇云呼军14 小时前
从 ElevenLabs 看工具调用:闪电智能 Voice Agent 的企业集成验收设计
android·大数据·运维·服务器·网络·人工智能·kotlin
1570925113416 小时前
Android 架构模式详解:从 MVC、MVP 到 MVVM
android·架构·mvc
aaajj16 小时前
Android手机连接鼠标情况
android
其实防守也摸鱼17 小时前
SQL注入实验笔记
android·运维·数据库·安全·oracle·自动化
找茬小王子17 小时前
Android原生Monkey工具的使用
android·monkey
Code Man17 小时前
实现 Android 字符设备驱动
android·驱动开发·lineageos