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