【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
相关推荐
还鮟1 小时前
CTF Web的数组巧用
android
小蜜蜂嗡嗡3 小时前
Android Studio flutter项目运行、打包时间太长
android·flutter·android studio
aqi003 小时前
FFmpeg开发笔记(七十一)使用国产的QPlayer2实现双播放器观看视频
android·ffmpeg·音视频·流媒体
zhangphil4 小时前
Android理解onTrimMemory中ComponentCallbacks2的内存警戒水位线值
android
你过来啊你4 小时前
Android View的绘制原理详解
android
移动开发者1号7 小时前
使用 Android App Bundle 极致压缩应用体积
android·kotlin
移动开发者1号7 小时前
构建高可用线上性能监控体系:从原理到实战
android·kotlin
ii_best12 小时前
按键精灵支持安卓14、15系统,兼容64位环境开发辅助工具
android
美狐美颜sdk12 小时前
跨平台直播美颜SDK集成实录:Android/iOS如何适配贴纸功能
android·人工智能·ios·架构·音视频·美颜sdk·第三方美颜sdk
恋猫de小郭17 小时前
Meta 宣布加入 Kotlin 基金会,将为 Kotlin 和 Android 生态提供全新支持
android·开发语言·ios·kotlin