在雷電論壇上看到很多adb命令,不過并沒有針對安卓按鍵進行處理,這里做了一下測試,把能用在安卓按鍵上的adb命令整理出來。
調用adb命令使用的山海插件中的Execute 執行shell命令
adb命令源碼如下:
Import "shanhai.lua"
shanhai.Execute ("setprop phone.imei 865166023949731")
/*
shanhai.execute("date 032114392017.22 set") 修改本地時間
shanhai.execute("wm size 720x1280") //修改分辨率
shanhai.Execute ("setprop call.keyboard back") //keypress
shanhai.Execute ("setprop call.reboot com.tencent.mm") //重啟模擬器,啟動指定包名
shanhai.Execute ("setprop call.input 文字") //輸入文字,支持中文
shanhai.Execute ("setprop call.network offline") //斷網 按鍵助手會斷開
ShanHai.execute("settings put global http_proxy 115.212.127.23:4274") //ip代理
shanhai.execute("settings delete global global_http_proxy_host") //清除ip代理
shanhai.Execute ("setprop call.network connect") //聯網
shanhai.Execute ("setprop call.shake null") //搖一搖 測試微信可用
shanhai.Execute ("setprop call.locate 117,29") //修改定位
shanhai.Execute ("am start -n com.tencent.mm/.ui.LauncherUI") //打開包名組件
shanhai.Execute ("am force-stop com.tencent.mm") //關閉軟件 包名
shanhai.Execute ("input text 123") //輸入文字 不支持中文
shanhai.Execute ("input tap 119 203") //點擊坐標
shanhai.Execute ("screencap -p /sdcard/pictures/screencap.png") //截屏
shanhai.Execute ("setprop phone.imei 865166023949731") //修改imei測試無效果,只針對getprop有效
TracePrint shanhai.Execute ("getprop phone.imei") //獲取imei
shanhai.Execute ("setprop phone.imsi 460000000000000") //imsi 有效
TracePrint shanhai.Execute ("getprop phone.imsi") //獲取imsi
shanhai.Execute ("setprop phone.simserial 89860000000000000000") //修改sim卡id號
TracePrint shanhai.Execute ("getprop phone.simserial") //獲取手機SIM卡id
shanhai.Execute ("setprop phone.linenum 13800000000") //設置手機號(重啟后自動回復原來的)
traceprint shanhai.Execute ("getprop phone.linenum") //獲取手機號
shanhai.Execute ("setprop ro.product.manufacturer iPhone") //設置手機品牌 (重啟后自動回復原來的)
TracePrint shanhai.Execute ("getprop ro.product.manufacturer") //獲取手機品牌
shanhai.Execute ("setprop ro.product.model iPhone12") //設置手機型號 (重啟后自動回復原來的)
TracePrint shanhai.Execute ("getprop ro.product.model") //獲取手機型號
shanhai.Execute ("pm install /sdcard/pictures/com.chiachiplee_1.apk") //安裝app install 安裝包路徑
shanhai.Execute ("pm uninstall com.chiachiplee") //卸載APP uninstall 包名
shanhai.Execute ("pm clear com.chiachiplee") //清除指定app 數據
TracePrint shanhai.Execute ("pm path com.tencent.mm") //獲取包名對應的APK路徑
TracePrint shanhai.Execute ("pm list packages") //獲取所有包名
TracePrint shanhai.Execute ("pm list packages -f") //獲取模擬器所有包名并且包括APK路徑
TracePrint shanhai.Execute ("getprop phone.androidid") //獲取安卓id
TracePrint shanhai.Execute ("getprop ro.build.date.utc") //獲取時間戳
TracePrint shanhai.Execute ("getprop ro.build.date") //獲取日期
TracePrint shanhai.Execute ("getprop keyguard.no_require_sim") //獲取sim卡1的狀態
shanhai.execute ("service call statusbar 1") //打開通知欄
shanhai.execute ("service call statusbar 2") //關閉通知欄
shanhai.execute ("mv ")
*/
TracePrint shanhai.GetTopActivity()
TracePrint shanhai.Execute ("getprop phone.net_operatorname")