0
点赞
收藏
分享

微信扫一扫

常用 ADB 命令

​​常用 ADB 命令 - 简书​​

TiTle

How

修改电量

adb shell dumpsys battery set level 100

查看蓝牙信息

adb shell dumpsys bluetooth_manager

查看Wi-Fi 信息

adb shell dumpsys wifi

待确认

adb shell svc power stayon [true/false/usb/ac] 设置屏幕的常亮,true保持常亮,false不保持,usb当插入usb时常亮,ac当插入电源时常亮

输出缓存

grep --line-buffered

Turn on/off mobile data

adb shell svc data [enable/disable]

性能

adb shell top -d 1 -m 10 -t

强制生成trace

/data/anr/traces.txt

Exception log

adb logcat -s */E

settings key 存储数据库

/data/data/com.android.providers.settings/databases/settings.db

查看飞行模式

adb shell settings get global airlpane_mode_on

查看WiFi 状态

1:开 0:关 adb shell settings get global wifi_on

开关WIFI

adb shell svc wifi enable/disable

获取mac

adb shell cat /sys/class/net/wlan0/address

格式化时间

adb shell date +"%Y%m%d%H%M%S"

长按

input keyevent --longpress

启动时间获取

adb logcat -c && adb logcat -s ActivityManager

屏幕

adb shell getevent -p grep -E "0035|0036"

分辨率

adb shell wm size

获取屏幕密度

wm density

数据开关

adb shell svc data enable/disadle

GPS&基站开

adb shell settings put secure location_providers_allowed +gps,+network

GPS&基站关

adb shell settings put secure location_providers_allowed -gps,-networknetwork:基站定位 gps:GPS定位

屏幕休眠时间(毫秒)

adb shell settings get system screen_off_timeout

设置屏幕休眠时间(毫秒)

adb shell settings put system screen_off_timeout 600000

View Hierarchy:

adb shell dumpsys activity top

挂断电话

adb shell service call phone 3

make call

adb shell am start -a android.intent.action.CALL -d tel:10010

前台activity

adb shell dumpsys window | grep mCurrentFocus

强制停止运行apk

adb shell am force-stop

获取包名list

adb shell pm list packages

检查设备是否亮屏

dumpsys power | grep 'Display Power: state'

信号

adb shell dumpsys telephony.registry

充电状态

dumpsys battery &#124 grep powered

驻网类型

getprop gsm.network.type

运营商类型

getprop gsm.operator.alpha

休眠策略

# kernel休眠

echo mem > /sys/power/state

# kernel唤醒echo on > /sys/power/state

echo a > /sys/power/wake_lock

echo a > /sys/power/wake_unlock

清除软件数据

pm clear "com.mobvoi.ticscreen.dialer"

禁用系统充电

adb shell settings put secure disable_charge_page 1adb shell dumpsys battery unplug

截屏

wm screen-captureadb shell screencap -p /sdcard/demo.png

通话状态

dumpsys telephony.registry | grep mCallState

锁网

adb shell am start -n com.qualcomm.qti.networksetting/.MobileNetworkSettings

WIFI 调试

ifconfig

adb tcpip 5555

adb connect <device-ip-address>

联系人数据库

adb pull /data/data/com.android.providers.contacts/databases

DNS

getprop | grep dns

audio大小

adb shell dumpsys audio | grep speaker

Wlan信号

获取信号强度

cat /proc/net/wireless | grep wlan0 | awk '{print $3}'

获取信号质量:单位dBm

cat /proc/net/wireless | grep wlan0 | awk '{print 5}'

网口的传输速率:Mb/s = 1000000bps

iwconfig wlan0 | sed 's/ /\n/g' | grep -i Rate | sed 's/=/ /g'|awk '{print $2}'

允许安装来源

apk adb shell settings put secure install_non_market_apps1

获取自动锁屏时间

adb shell settings list system | grep timeout

设置永不锁屏

adb shell settings put system screen_off_timeout 2147483647

代理 设置代理

adb shell settings put global http_proxy 127.0.0.1:8888

移除代理

adb shell settings delete global http_proxy

adb shell settings delete global global_http_proxy_host

adb shell settings delete global global_http_proxy_port adb reboot

卸载app

pm uninstall -k --user 0 package

获取imei windows

adb shell "service call iphonesubinfo 1 | grep -o '[0-9a-f]{8} ' | tail -n+3 | while read a; do echo -n \u${a:4:4}\u${a:0:4}; done"

获取imei windows

adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed '1 d' | tr -d '.' | awk '{print}' ORS=

获取imei linux

adb shell 'service call iphonesubinfo 1 | grep -o "[0-9a-f]{8} " | tail -n+3 | while read a; do echo -n "\u${a:4:4}\u${a:0:4}"; done'

更改屏幕亮度

adb shell settings put system screen_brightness 150

获取屏幕亮度

adb shell settings get system screen_brightness

adb disable-verity 

作者:非著名自行车运动员
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 


举报

相关推荐

0 条评论