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 SKIP_TOOLCHAIN_SETUP="true" |
6 source $SCRIPT_DIR/android_setup.sh | 7 source $SCRIPT_DIR/android_setup.sh |
7 source $SCRIPT_DIR/utils/setup_adb.sh | 8 source $SCRIPT_DIR/utils/setup_adb.sh |
8 | 9 |
9 # Helper function used by get_battery_level. Parses the battery level from | 10 # Helper function used by get_battery_level. Parses the battery level from |
10 # dumpsys output. | 11 # dumpsys output. |
11 function _parse_battery_level { | 12 function _parse_battery_level { |
12 SPLIT=( $@ ) | 13 SPLIT=( $@ ) |
13 | 14 |
14 HAS_BATTERY=1 | 15 HAS_BATTERY=1 |
15 LEVEL="" | 16 LEVEL="" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 # Wait for battery charge. | 75 # Wait for battery charge. |
75 DESIRED_BATTERY_LEVEL=80 | 76 DESIRED_BATTERY_LEVEL=80 |
76 CURRENT_BATTERY_LEVEL="$(get_battery_level)" | 77 CURRENT_BATTERY_LEVEL="$(get_battery_level)" |
77 while [ "${CURRENT_BATTERY_LEVEL}" -lt "${DESIRED_BATTERY_LEVEL}" ]; do | 78 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}" | 79 echo "Battery level is ${CURRENT_BATTERY_LEVEL}; waiting to charge to ${DESIRE
D_BATTERY_LEVEL}" |
79 sleep 5 | 80 sleep 5 |
80 CURRENT_BATTERY_LEVEL="$(get_battery_level)" | 81 CURRENT_BATTERY_LEVEL="$(get_battery_level)" |
81 done | 82 done |
82 | 83 |
83 echo "Ready!" | 84 echo "Ready!" |
OLD | NEW |