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