OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Wait for the device to be charged enough for testing. | 3 # Wait for the device to be charged enough for testing. |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 66 |
66 # Wait for battery charge. | 67 # Wait for battery charge. |
67 DESIRED_BATTERY_LEVEL=80 | 68 DESIRED_BATTERY_LEVEL=80 |
68 CURRENT_BATTERY_LEVEL="$(get_battery_level)" | 69 CURRENT_BATTERY_LEVEL="$(get_battery_level)" |
69 while [ "${CURRENT_BATTERY_LEVEL}" -lt "${DESIRED_BATTERY_LEVEL}" ]; do | 70 while [ "${CURRENT_BATTERY_LEVEL}" -lt "${DESIRED_BATTERY_LEVEL}" ]; do |
70 echo "Battery level is ${CURRENT_BATTERY_LEVEL}; waiting to charge to ${DESIRE
D_BATTERY_LEVEL}" | 71 echo "Battery level is ${CURRENT_BATTERY_LEVEL}; waiting to charge to ${DESIRE
D_BATTERY_LEVEL}" |
71 sleep 5 | 72 sleep 5 |
72 CURRENT_BATTERY_LEVEL="$(get_battery_level)" | 73 CURRENT_BATTERY_LEVEL="$(get_battery_level)" |
73 done | 74 done |
74 | 75 |
75 echo "Charged!" | 76 echo "Charged!" |
OLD | NEW |