文章

常用的adb命令

小老弟,你要遭老罪咯

查看launcher

1
cmd package resolve-activity --brief pkgname

获取当前屏幕顶层activity

1
dumpsys activity activities |grep -E ResumedActivity

禁用设置指纹界面

1
pm disable com.android.settings/com.oplus.settings.feature.fingerprint.OplusFingerprintSettings

获取当前wifi地址

1
ip -4 addr show wlan0 | awk '/inet / {print $2}' | cut -d'/' -f1

修改数字密码(PIN码)

1
locksettings set-pin --old 123456 123456

禁用bilibili

1
pm disable tv.danmaku.bili

禁用抖音

1
pm disable com.ss.android.ugc.aweme

锁屏

1
input keyevent 26

打开拨号键盘

1
input keyevent 5

息屏

1
input keyevent 6

禁用wifi

1
svc wifi disable

滑动 x1, y1, x2, y2, time

1
input swipe 500 1500 500 500 30

禁用小程序

1
for c in com.tencent.mm/.plugin.appbrand.ui.AppBrandUI com.tencent.mm/.plugin.appbrand.ui.AppBrandUI1 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI00 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI01 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI02 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI03 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI04; do pm disable "$c"; done

启用小程序

1
for c in com.tencent.mm/.plugin.appbrand.ui.AppBrandUI com.tencent.mm/.plugin.appbrand.ui.AppBrandUI1 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI00 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI01 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI02 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI03 com.tencent.mm/.plugin.appbrand.ui.AppBrandUI04; do pm enable "$c"; done

无线循环执行强制灭屏

1
while true; do input keyevent 6; sleep 0; done

执行截图命令

1
adb exec-out screencap -p > screenshot.png

ssh手动开启adb连接tcp 先设置属性

1
setprop service.adb.tcp.port 5555

关闭adbd

1
stop adbd

再启动adbd

1
start adbd

设置电池电量

1
dumpsys battery set level 4

修改屏幕分辨率

1
wm size 720x160

恢复屏幕分辨率

1
wm size reset
本文由作者按照 CC BY 4.0 进行授权