我们经常发现源码里有一些dump方法,里面打印了activity或者service的一些log信息。
那么如何通过adb抓取dump信息呢
1、adb调用activity中的dump方法
adb shell dumpsys activity <activity_component_name>
adb shell dumpsys activity com.android.launcher3/com.android.searchlauncher.SearchLauncher
2、adb调用service中的dump方法
adb shell dumpsys activity service
adb shell dumpsys activity service com.android.quickstep.TouchInteractionService
3、dump wallpaper信息
adb shell dumpsys wallpaper
参考:https://blog.csdn.net/weixin_26821003/article/details/117582560
4、获取屏幕亮度
adb shell "dumpsys power | grep mScreenBrightnessSetting"
5、获取手机电量
adb shell dumpsys battery
6、//git 大项目git status获取缓慢
https://github.com/jgavris/rs-git-fsmonitor
# Install and link packages
sudo hab pkg install jgavris/rs-git-fsmonitor
sudo hab pkg binlink jgavris/rs-git-fsmonitor
sudo hab pkg binlink jarvus/watchman
# Ensure service directory exists and is writable
sudo mkdir -p /hab/svc/watchman/var
sudo chmod o+rwx /hab/svc/watchman/var
# Configure git repository to use the tool (run in desired large git repository):
git config --global core.fsmonitor rs-git-fsmonitor
#uninstall
git config --unset core.fsmonitor
sudo apt-get install jgavris/rs-git-fsmonitor
7、打开状态栏秒显示时间
1. 打开状态栏时间显示秒针功能:
手机连接adb依次执行如下命令:
adb root
adb remount
adb shell pm enable com.android.systemui/com.android.systemui.tuner.TunerActivity
adb shell am start -n com.android.systemui/com.android.systemui.tuner.TunerActivity
此时进入了System UI Tuner界面,点击statusbar,滑动到页面底部,点击time,选择显示时分秒,此时状态栏上的时间会显示“秒”
8、adb 清除LOGCAT
adb logcat -c -b main -b events -b radio -b system
9、adb打印activity task信息
https://www.cnblogs.com/onelikeone/p/11212828.html
adb shell "dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'"
10、find命令查找文件太多报错信息
在后面添加2>/dev/null 把错误日志重定向
find / -name *wallpaper* 2>/dev/null
11、adb获取feature列表
#adb获取feature列表
adb shell pm list features >x6526_features.log
#启动mtk log界面
adb shell am start -n com.debug.loggerui/com.debug.loggerui.MainActivity
#mtk 当前背光亮度值
adb shell cat /sys/class/leds/lcd-backlight/brightness
#cpu架构
adb shell getprop |findstr cpu.abi
#adb获取/设置settings privider数据库的值
Settings.System
Settings.Secure
Settings.Global
adb shell settings get global adb_enabled
adb shell settings get secure ***name
adb shell settings get system ***name
adb shell settings put global ***name value
adb shell settings put secure ***name value
adb shell settings put system ***name value
代码获取:Settings.Global.getString(Context.getContentResolver(), "Key");
代码设置:Settings.Global.putString(Context.getContentResolver(), "Key", Value);