| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Wait for the device to be ready to run tests. | 3 # Wait for the device to be ready to run tests. |
| 4 | 4 |
| 5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 6 source $SCRIPT_DIR/android_setup.sh | 6 source $SCRIPT_DIR/android_setup.sh |
| 7 source $SCRIPT_DIR/utils/setup_adb.sh | 7 source $SCRIPT_DIR/utils/setup_adb.sh |
| 8 | 8 |
| 9 # Helper function used by get_battery_level. Parses the battery level from | 9 # Helper function used by get_battery_level. Parses the battery level from |
| 10 # dumpsys output. | 10 # dumpsys output. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 set -e | 66 set -e |
| 67 | 67 |
| 68 # Wait for the device to be connected and fully booted. | 68 # Wait for the device to be connected and fully booted. |
| 69 while [ "$($ADB $DEVICE_SERIAL shell getprop sys.boot_completed | tr -d '\r')" !
= "1" ]; do | 69 while [ "$($ADB $DEVICE_SERIAL shell getprop sys.boot_completed | tr -d '\r')" !
= "1" ]; do |
| 70 echo "Waiting for the device to be connected and ready." | 70 echo "Waiting for the device to be connected and ready." |
| 71 sleep 5 | 71 sleep 5 |
| 72 done | 72 done |
| 73 | 73 |
| 74 # Wait for battery charge. | 74 # Wait for battery charge. |
| 75 DESIRED_BATTERY_LEVEL=30 | 75 DESIRED_BATTERY_LEVEL=100 |
| 76 CURRENT_BATTERY_LEVEL="$(get_battery_level)" | 76 CURRENT_BATTERY_LEVEL="$(get_battery_level)" |
| 77 while [ "${CURRENT_BATTERY_LEVEL}" -lt "${DESIRED_BATTERY_LEVEL}" ]; do | 77 while [ "${CURRENT_BATTERY_LEVEL}" -lt "${DESIRED_BATTERY_LEVEL}" ]; do |
| 78 echo "Battery level is ${CURRENT_BATTERY_LEVEL}; waiting to charge to ${DESIRE
D_BATTERY_LEVEL}" | 78 echo "Battery level is ${CURRENT_BATTERY_LEVEL}; waiting to charge to ${DESIRE
D_BATTERY_LEVEL}" |
| 79 sleep 5 | 79 sleep 5 |
| 80 CURRENT_BATTERY_LEVEL="$(get_battery_level)" | 80 CURRENT_BATTERY_LEVEL="$(get_battery_level)" |
| 81 done | 81 done |
| 82 | 82 |
| 83 echo "Ready!" | 83 echo "Ready!" |
| OLD | NEW |