常用工具箱:常用调试命令

OpenAPP

#!/bin/bash
dir=D:/2019/APK/OpenAPP/Package/*
temp=D:/2019/APK/OpenAPP/temp.txt
suffix=apk
if [ $temp ];then
	rm $temp
fi
for file in $dir
{	
	if [ ${file##*.}==$suffix ];then
		apk=${file}
	fi
	pkg=$(aapt dump badging ${apk}|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
	echo ${pkg}>>$temp
}

GetDumpSysLog

echo on
adb root
adb remount
adb pull data/system/packages.list   packages.list

echo on
adb shell dumpsys > Dumpsys.txt

echo on
adb shell dumpsys cpuinfo > Cpuinfo.txt

echo on
adb shell dumpsys meminfo > MemInfo.txt

adb shell getprop > prop.txt

echo 查看后台应用使用情况
adb shell top -m 10 -s cpu

GetGMSVision

echo on
adb shell dumpsys package com.google.android.gms > GMS_info.txt

SurfaceFlinger

可以得到当前界面的包名和className

echo on
adb shell dumpsys SurfaceFlinger > SurfaceFlinger.txt

adb shell dumpsys window | grep mCurrentFocus

TcpDump 命令

adb root
adb remount
rm -rf TcpDump
mkdir TcpDump
adb shell dumpsys netd trafficcontroller > ./TcpDump/trafficcontroller.txt
adb shell iptables -L > ./TcpDump/iptables_L.txt
adb shell iptables -S > ./TcpDump/iptables_S.txt
adb pull /data/system/packages.xml > ./TcpDump/packages.xml
pause

Bugreport 命令


echo on
adb shell dumpsys batterystats > Batterystats.txt

echo on
adb shell dumpsys battery > Battery.txt

echo on
adb bugreport > Bugreport.txt
adb shell bugreport > Bugreport.zip

echo on
adb shell dumpsys batterystats --reset
adb shell dumpsys batterystats --enable full-wake-history

启动 battery-historian 命令
@echo on
cd D:\GoSoftWare\data\gowork\src\github.com\google\battery-historian
D:
go run .\setup.go
go run .\cmd\battery-historian\battery-historian.go http://localhost:9999/
pause

native_cmd

adb root
adb shell setenforce 0
adb shell
cd /data/local/
chmod 777 tmp
adb shell setprop libc.debug.malloc.program app_process64
setprop libc.debug.malloc.options "backtrace_enable_on_signal backtrace leak_track"
adb shell setprop libc.debug.malloc.options "backtrace=3"
stop
start
ps -A | grep system_server kill -45 <pid of system_server>
[Now you can reproduce the memory leak issue, after issue appeared, you can go to the next step
to generate the memory leak backtrace. ]
kill -47 <pid of system_server>
[After a 'malloc/new/free' function triggered in 'system_server' at this time, you'll find memory dump
logs under the path: /data/local/tmp/ now. ]

hw powergenius 命令

adb root
adb remount
adb shell

adb shell "dumpsys powergenius abnormal"
adb shell "dumpsys powergenius policy"
adb shell "dumpsys powergenius appmamager"
adb shell "dumpsys powergenius device"
adb shell "dumpsys powergenius scenario" // 查看当前场景
adb shell "dumpsys powergenius actions"
adb shell "dumpsys powergenius ca"
adb shell "dumpsys powergenius powerstats"
adb shell "dumpsys powergenius sdk"
adb shell "dumpsys powergenius batterystats"
adb shell "dumpsys powergenius help"

su

setprop persist.sys.pg_tips_debug true

getprop persist.sys.pg_tips_debug

## 必须设置为false,否则无法弹出消息提醒
setprop persist.sys.pg_usb_debug false
getprop persist.sys.pg_usb_debug

setprop persist.sys.pg_dbg_download true

getprop persist.sys.pg_dbg_download

setprop persist.sys.pg_dbg_power true

getprop persist.sys.pg_dbg_power

setprop persist.sys.pg_character_dbg true

getprop persist.sys.pg_character_dbg

setprop persist.sys.pg_fd_debug true

getprop persist.sys.pg_fd_debug

reboot

exit

pause
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

法迪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值