0
点赞
收藏
分享

微信扫一扫

#我的新年Flag#ADB 常用指令(二)

夏天的枫_ 2023-02-03 阅读 151
查看前台Activity

adb shell dumpsys activity activities | grep mFocusedActivity

---------

C:\Users\BZZX>adb shell
shell@Hi3798MV300:/ $ dumpsys activity activities | grep mFocusedActivity
mFocusedActivity: ActivityRecord{41c28618 u0 com.zc.gamehall/.MainActivity t18}
shell@Hi3798MV300:/ $

查询应用安装路径

C:\Users\BZZX>adb shell pm path com.zc.gamehall
package:/data/app/com.zc.gamehall-1.apk

adb 模拟操作键值

adb shell input keyevent <keycode>

| keycode | 含义 |
|---------|--------------------------------|
| 3 | HOME 键 |
| 4 | 返回键 |
| 5 | 打开拨号应用 |
| 6 | 挂断电话 |
| 24 | 增加音量 |
| 25 | 降低音量 |
| 26 | 电源键 |
| 27 | 拍照(需要在相机应用里) |
| 64 | 打开浏览器 |
| 82 | 菜单键 |
| 85 | 播放/暂停 |
| 86 | 停止播放 |
| 87 | 播放下一首 |
| 88 | 播放上一首 |
| 122 | 移动光标到行首或列表顶部 |
| 123 | 移动光标到行末或列表底部 |
| 126 | 恢复播放 |
| 127 | 暂停播放 |
| 164 | 静音 |
| 176 | 打开系统设置 |
| 187 | 切换应用 |
| 207 | 打开联系人 |
| 208 | 打开日历 |
| 209 | 打开音乐 |
| 210 | 打开计算器 |
| 220 | 降低屏幕亮度 |
| 221 | 提高屏幕亮度 |
| 223 | 系统休眠 |
| 224 | 点亮屏幕 |
| 231 | 打开语音助手 |
| 276 | 如果没有 wakelock 则让系统休眠 |

模拟滑动解锁

adb shell input swipe 300 1000 300 500  # 坐标因机型不同适配

模拟输入文本

adb shell input text hello

adb 输出日志级别

adb logcat -v / -s  time / threadtime

Android 的日志分为如下几个优先级(priority):

* V —— Verbose(最低,输出得最多)
* D —— Debug
* I —— Info
* W —— Warning
* E —— Error
* F —— Fatal
* S —— Silent(最高,啥也不输出)

输出设备型号

C:\Users\BZZX>adb shell getprop ro.product.model
HG680-KA

输出设备电池状态

C:\Users\BZZX>adb shell dumpsys battery
Current Battery Service state:
AC powered: false
USB powered: false
Wireless powered: false
status: 1
health: 1
present: true
level: 0
scale: 100
voltage: 0
temperature: 0
technology:

查看设备分辨率

C:\Users\BZZX>adb shell wm size   # wm: window manager
Physical size: 1280x720

-----
如果曾经通过指令修改过分辨率,会显示
Physical size:
Override size:

查看设备屏详细参数

C:\Users\BZZX>adb shell dumpsys window displays
WINDOW MANAGER DISPLAY CONTENTS (dumpsys window displays)
Display: mDisplayId=0
init=1280x720 160dpi cur=1280x720 app=1280x720 rng=720x720-1280x1280

查看设备显示屏密度

C:\Users\BZZX>adb shell wm density
Physical density: 160

举报

相关推荐

#我的新年Flag#OSI

#我的新年Flag#hostPath存储

#我的新年Flag#NFS存储

#我的新年Flag#NFS配置简介

#我的新年Flag#K8s PVC

0 条评论