1#!/bin/bash 2 3# The files to save output to. 4RAWLOGS_FILE=connectivity-rawlogs.txt 5ANALYSIS_FILE=connectivity-analysis.txt 6 7# Turn on the screen and unlock the device 8# TODO: Power on 9adb shell wm dismiss-keyguard 10adb logcat -P "" 11 12airplane_mode_was_on=$(adb shell settings get global airplane_mode_on) 13if [ $airplane_mode_was_on == 1 ] ; then 14 adb shell settings put global airplane_mode_on 0 > /dev/null 15 adb shell am broadcast -a android.intent.action.AIRPLANE_MODE > /dev/null 16 sleep 30 17fi 18 19# Start the analysis process 20$TOP/development/tools/logblame/analyze_logs.py --duration=10m --clear --rawlogs $RAWLOGS_FILE \ 21 | tee $ANALYSIS_FILE & 22analyze_pid=$! 23 24# Turn on airplane mode and wait for it to settle 25echo "Turning on airplane mode." 26adb shell settings put global airplane_mode_on 1 > /dev/null 27adb shell am broadcast -a android.intent.action.AIRPLANE_MODE > /dev/null 28sleep 15 29 30# Turn off airplane mode and wait for it to settle 31echo "Turning off airplane mode." 32adb shell settings put global airplane_mode_on 0 > /dev/null 33adb shell am broadcast -a android.intent.action.AIRPLANE_MODE > /dev/null 34sleep 45 35 36# Turn off wifi and then back on 37echo "Turning wifi off" 38adb shell svc wifi disable 39sleep 15 40 41echo "Turning wifi on" 42adb shell svc wifi enable 43sleep 15 44 45 46echo 47echo 48 49# Kill adb to disconnect logcat 50adb kill-server 51 52# Wait for the pyton process to exit 53wait $analyze_pid 54 55echo "Wrote raw logs to $RAWLOGS_FILE" 56echo "Wrote analysis to $ANALYSIS_FILE" 57 58 59