adb 进阶用法

我们经常发现源码里有一些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);
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值