ADB

adb shell 運(yùn)行l(wèi)ua文件

1, android設(shè)備root權(quán)限
2, 將liblasa.so push到/system/lib下
3, 將lasa push 到/system/bin/下 , chmod 777 lasa
4, 將需要測(cè)試的lua腳本和資源等相關(guān)so puah到/data/test/目錄下
5, 調(diào)用lasa test.lub
6, 測(cè)試相關(guān)打印在logcat -s lasa 輸出

查詢(xún)ip

adb shell ip addr
adb shell netcfg

錄屏

adb shell screenrecord /sdcard/test.mp4

  1. 視頻保存目錄可以自己指定,如上面的/sdcard/test.mp4,命令執(zhí)行后會(huì)一直錄制180s,按下ctrl+c可以提前結(jié)束錄制輸入 –time-limit N,限制視頻錄制時(shí)間為N秒
  2. 對(duì)于高分辨率的手機(jī),錄制的視頻很大
    adb shell screenrecord --size 848*480 /sdcard/test.mp4
  3. 默認(rèn)比特率是4M/s,為了分享方便,我們可以調(diào)低比特率為2M
    adb shell screenrecord --bit-rate 2000000 /sdcard/test.mp4
  4. 使用adb pull 即可把手機(jī)SD卡中視頻獲取到本地
    adb pull /sdcard/test.mp4 .

日志過(guò)濾

反向過(guò)濾 : adb shell "logcat -v threadtime | grep -vE "lasa || Mtk""
正向過(guò)濾 :adb logcat lasa:D HomeNode:I *:S
只打印錯(cuò)誤 : adb logcat *:E

選項(xiàng)解析 :
-- "-s"選項(xiàng) : 設(shè)置輸出日志的標(biāo)簽, 只顯示該標(biāo)簽的日志;
-- "-f"選項(xiàng) : 將日志輸出到文件, 默認(rèn)輸出到標(biāo)準(zhǔn)輸出流中, -f 參數(shù)執(zhí)行不成功;
-- "-r"選項(xiàng) : 按照每千字節(jié)輸出日志, 需要 -f 參數(shù), 不過(guò)這個(gè)命令沒(méi)有執(zhí)行成功;
-- "-n"選項(xiàng) : 設(shè)置日志輸出的最大數(shù)目, 需要 -r 參數(shù), 這個(gè)執(zhí)行 感覺(jué) 跟 adb logcat 效果一樣;
-- "-v"選項(xiàng) : 設(shè)置日志的輸出格式, 注意只能設(shè)置一項(xiàng);
-- "-c"選項(xiàng) : 清空所有的日志緩存信息;
-- "-d"選項(xiàng) : 將緩存的日志輸出到屏幕上, 并且不會(huì)阻塞;
-- "-t"選項(xiàng) : 輸出最近的幾行日志, 輸出完退出, 不阻塞;
-- "-g"選項(xiàng) : 查看日志緩沖區(qū)信息;
-- "-b"選項(xiàng) : 加載一個(gè)日志緩沖區(qū), 默認(rèn)是 main, 下面詳解;
-- "-B"選項(xiàng) : 以二進(jìn)制形式輸出日志;

查看機(jī)器信息

adb shell getprop | grep -E "model|version.sdk|manufacture|hardware|platform|revision|serialno|product.name|brand"
附加:
grep 同時(shí)滿(mǎn)足多個(gè)關(guān)鍵字和滿(mǎn)足任意關(guān)鍵字
① grep -E "word1|word2|word3" file.txt
滿(mǎn)足任意條件(word1、word2和word3之一)將匹配。
② grep word1 file.txt | grep word2 |grep word3
必須同時(shí)滿(mǎn)足三個(gè)條件(word1、word2和word3)才匹配

adb起不來(lái)

netstat -ano >./Desktop/t.txt 找到哪個(gè)占用了5037
TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       4680
taskkill /F /pid 4680         
再?lài)L試adb shell.

adb 查看常用屬性

adb shell getprop | findstr "gsm" : 顯示包含gsm的系統(tǒng)屬性
adb shell cat /proc/meminfo : 查看當(dāng)前內(nèi)存情況
adb shell cat /proc/cpuinfo : cpu情況
adb shell cat /proc/iomem : io內(nèi)存分區(qū)

截圖

adb shell screencap -p /sdcard/1.png
adb pull /sdcard/1.png

廣播

am broadcast -a 廣播action : 發(fā)送一條廣播
adb shell am broadcast 后面的參數(shù)有:
[-a <ACTION>]
[-d <DATA_URI>]
[-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>]
[-f <FLAGS>] [<URI>]

例如: aiosTTS播報(bào)測(cè)試
adb shell am broadcast -a aios.intent.action.SPEAK --es aios.intent.extra.TEXT 地圖縮小 --ei aios.intent.extra.PRIORITY 1

pm am

am startservice -a 服務(wù)action : 啟動(dòng)一項(xiàng)服務(wù)
am force-stop 包名 : 強(qiáng)制關(guān)閉一個(gè)應(yīng)用

package manager 簡(jiǎn)稱(chēng) pm
pm install apk路徑 : 安裝程序
pm uninstall 包名 : 卸載程序
pm disable 包名 : 禁用應(yīng)用
pm enable 包名 : 啟用
pm -p 包名 : 應(yīng)用裝在哪里
pm list permissions
查看6.0需要?jiǎng)討B(tài)申請(qǐng)危險(xiǎn)權(quán)限
pm list permissions -d -g

input keyevent

input keyevent num : num=3:home鍵 num=4:back鍵
input text "str" : 文本輸入 str
參考

dump系統(tǒng)信息

dumpsys activity|grep mFocusedActivity 哪個(gè)activity在最前面

top -m 10 -s cpu -d 取前十條,已cpu的暫用降序排列.-d刷新周期(秒)
svc wifi enable / svc wifi disable : 開(kāi)關(guān)wifi
service list : services信息
dumpsys meminfo <package_name> : 內(nèi)存使用情況
dumpsys package <package_name> : 安裝包信息
df : 設(shè)備文件信息
mount -o remount rw /system : 把system目錄掛載為可讀寫(xiě)(mouont -rw -o remount /system)

procrank | grep com.aispeech.aios 查看aios內(nèi)存占用情況
dumpsys meminfo com.aispeech.aios 查看aios內(nèi)存占用情況
dumpsys cpuinfo 查看cpu占用情況
top -m 10 -s cpu 查cpu占用前10情況
busybox top 實(shí)時(shí)查看CPU占用情況
cat /proc/cpuinfo 查看硬件cpu參數(shù)

dumpsys :

dumpsys [options]
meminfo 顯示內(nèi)存信息
cpuinfo 顯示CPU信息
account 顯示accounts信息
activity 顯示所有的activities的信息
window 顯示鍵盤(pán),窗口和它們的關(guān)系
wifi 顯示wifi信息

mac地址
file = fopen("/sys/class/net/wlan0/address", "rb");
file = fopen("/sys/class/net/usb0/address", "rb");

時(shí)區(qū)
adb shell
cat /data/property/persist.sys.timezone //時(shí)區(qū)配置文件
setprop persist.sys.timezone GMT //修改屬性

wifi連接adb調(diào)試

  1. 手機(jī)需要安裝終端(如 : BetterTerminal)
  2. 運(yùn)行: su
    setprop service.adb.tcp.port 5555
    stop adbd
    start adbd
  3. 查看手機(jī)ip 192.168.0.50 (哈哈 ,我的 , 同志們別亂連)
  4. adb connect 192.168.0.50 : 5555
    顯示connected to 192.168.0.50:5555表示連接成功

誰(shuí)占用了mic

adb shell dumpsys media.audio_flinger

Tracks of which 1 are active
Active Client Fmt Chn mask Session S Server fCount SRate
yes 2745 1 0000000C 24 6 0742E2AA 8000 16000
0 Effect Chains

Reroute submix audio module:
route[0] rate in=0 out=0, addr=[]
route[1] rate in=0 out=0, addr=[]
route[2] rate in=0 out=0, addr=[]
route[3] rate in=0 out=0, addr=[]
route[4] rate in=0 out=0, addr=[]
route[5] rate in=0 out=0, addr=[]
route[6] rate in=0 out=0, addr=[]
route[7] rate in=0 out=0, addr=[]
route[8] rate in=0 out=0, addr=[]
route[9] rate in=48000 out=48000, addr=[]
root@rmt8735_6tb_s_l1:/ # ps |grep aios
u0_a47 2672 279 996904 30416 ffffffff f710c988 S com.aispeech.aios.wechat
u0_a47 2745 279 1136052 98968 ffffffff f710c988 S com.aispeech.aios
system 2831 278 1344608 47140 ffffffff a3cd444c S com.aispeech.aios.adapter

高通cpu測(cè)試

#! /bin/bash
timestamp=`date +20%y%m%d%H%M%S`
while true
    do sleep 1
    adb shell cat /sys/devices/system/cpu/online >> ./cpuinfo.txt
    adb shell "top -n 1 | grep -e \"com.aispeech.aios\"" >> ./cpuinfo.txt
done

簽名文件對(duì)比

可以比對(duì)apk簽名的fingerprint
假定安裝了JDK,如果想查HelloWorld.apk所使用的簽名的fingerprint,可以這樣做:

  1. 查找apk里的rsa文件

(Windows)

jar tf HelloWorld.apk |findstr RSA

(Linux)
$ jar tf HelloWorld.apk |grep RSA

META-INF/CERT.RSA

  1. 從apk中解壓rsa文件

jar xf HelloWorld.apk META-INF/CERT.RSA

  1. 獲取簽名的fingerprints

keytool -printcert -file META-INF/CERT.RSA

...
Certificate fingerprints:
MD5: BC:6D:BD:6E:49:69:2A:57:A8:B8:28:89:04:3B:93:A8
SHA1: 0D:DF:76:F4:85:96:DF:17:C2:68:1D:3D:FF:9B:0F:D2:A1:CF:14:60
Signature algorithm name: SHA1withRSA
Version: 3
...

  1. 清理工作,刪除rsa文件

(Windows)
rmdir /S /Q META-INF

(Linux)
rm -rf META-INF

debug.keystore系統(tǒng)簽名

創(chuàng)建key,需要用到keytool.exe (位于jdk1.6.0_24\jre\bin目錄下),使用產(chǎn)生的key對(duì)apk簽名用到的是jarsigner.exe (位于jdk1.6.0_24\bin目錄下),把上兩個(gè)軟件所在的目錄添加到環(huán)境變量path后,打開(kāi)cmd輸入

D:>keytool -genkey -alias demo.keystore -keyalg RSA -validity 40000 -keystore demo.keystore
/說(shuō)明:-genkey 產(chǎn)生密鑰
-alias demo.keystore 別名 demo.keystore
-keyalg RSA 使用RSA算法對(duì)簽名加密
-validity 40000 有效期限4000天
-keystore demo.keystore /
D:>jarsigner -verbose -keystore demo.keystore -signedjar demo_signed.apk demo.apk androiddebugkeystore
/
說(shuō)明:-verbose 輸出簽名的詳細(xì)信息
-keystore demo.keystore 密鑰庫(kù)位置
-signedjar demor_signed.apk demo.apk demo.keystore 正式簽名,三個(gè)參數(shù)中依次為簽名后產(chǎn)生的文件demo_signed,要簽名的文件demo.apk和密鑰庫(kù)androiddebugkeystore
/

參考

雜七雜八

  1. mtk驅(qū)動(dòng)層錄音

com.mediatek.engineermode/.audio.AudioAudioLogger或者電話(huà)鍵盤(pán)##3646633##
勾選input
adb root
kill mediaserver
adb pull /sdcard/mtklog/audio_dump/


aapt常用總結(jié)

aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]
badging Print the label and icon for the app declared in APK.
permissions Print the permissions from the APK.
resources Print the resource table from the APK.
configurations Print the configurations in the APK.
xmltree Print the compiled xmls in the given assets.
xmlstrings Print the strings of the given compiled xml assets.

來(lái)源

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容