bat脚本结合adb命令实现生产安卓手机时,进入工厂模式模式自动、半自动测试,非常的实用,可以提高工厂测试效率,节省人力。
当然具体的项目需要按照具体的值去调整,以下代码我的项目是可以运行的,但在其他项目也许用不了,代码可以作为参考,你可以修改下具体的数值就可以用。
@echo off
echo ------工厂测试开始------
echo ----启动app
adb shell am start -n com.sprd.validationtools/.ValidationToolsMainActivity
echo ----查看版本信息
ping -n 1 127.0.0.1>nul
adb shell input tap 200 130
echo ----查看校准信息
ping -n 1 127.0.0.1>nul
adb shell input tap 100 670
echo ----RTC测试
ping -n 1 127.0.0.1>nul
adb shell input tap 100 670
echo ----背光测试
ping -n 1 127.0.0.1>nul
adb shell input tap 100 670
echo ----LCD测试
ping -n 1 127.0.0.1>nul
adb shell input tap 100 670
ping -n 5 127.0.0.1>nul
adb shell input tap 100 670
echo ----单点触摸测试
ping -n 1 127.0.0.1>nul
adb shell input swipe 90 120 380 700
ping -n 1 127.0.0.1>nul
adb shell input swipe 390 130 90 720
echo ----多点触摸测试,请手动操作,5秒后结束!!!!!!
ping -n 6 127.0.0.1>nul
echo ----铃声马达测试,请手接触手机,看是否震动!!!!!
ping -n 5 127.0.0.1>nul
adb shell input tap 100 670
echo ----麦克、听筒、喇叭测试
ping -n 10 127.0.0.1>nul
adb shell input tap 100 670
echo ----电话测试
ping -n 2 127.0.0.1>nul
::免提
adb shell input tap 400 346
ping -n 6 127.0.0.1>nul
::挂断
adb shell input tap 240 700
ping -n 2 127.0.0.1>nul
adb shell input tap 100 670
echo ----Genser测试
ping -n 3 127.0.0.1>nul
adb shell input tap 100 670
echo ----距离感应测试
ping -n 1 127.0.0.1>nul
adb shell input tap 100 670
echo ----前摄测试,请注意看手机!!!!!!
ping -n 6 127.0.0.1>nul
adb shell input tap 100 670
echo ----后摄测试,请注意看手机!!!!!!
ping -n 6 127.0.0.1>nul
adb shell input tap 100 670
echo ----按键测试
adb shell input keyevent 25
ping -n 1 127.0.0.1>nul
adb shell input keyevent 24
echo ----充放电测试
ping -n 3 127.0.0.1>nul
adb shell input tap 100 670
echo ----耳机测试,请插入耳机。10秒后开始!!!!!
ping -n 10 127.0.0.1>nul
adb shell input tap 100 670
echo ----FM测试
ping -n 5 127.0.0.1>nul
adb shell input tap 100 670
echo ----蓝牙测试
ping -n 5 127.0.0.1>nul
adb shell input tap 100 670
echo ----WIFI测试
ping -n 5 127.0.0.1>nul
adb shell input tap 100 670
echo ----GPS测试
ping -n 5 127.0.0.1>nul
adb shell input tap 100 670
echo ----OTG测试
ping -n 3 127.0.0.1>nul
adb shell input tap 100 670
echo ------工厂测试结束------
pause