分享一个脚本给大家,安卓后台定时执行 shell 脚本,测试完成后自动重启:
#!/system/bin/sh
#初始条件:进入来画首页
logcat -b main -b system -b radio -b events -v time >logcat.log &
#开始测试时间戳
start=$(date +%s)
#echo start:$start
while true
do
#进入绘画
input tap 220 220
sleep 2
#光机开启
input swipe 222 160 80 160
sleep 2
date +%H:%M:%S>>time.txt
cat /sys/devices/virtual/thermal/thermal_zone4/temp>>pcb.txt
cat /sys/class/power_supply/battery/temp>>battery.txt