Chromium Code Reviews| Index: build/android/provision_devices.py |
| diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py |
| index 5f00b31e8a817440b99d845b6745401c6d46c947..f70526f7bc3cb526358931067bba0b4a2ca5f78d 100755 |
| --- a/build/android/provision_devices.py |
| +++ b/build/android/provision_devices.py |
| @@ -22,6 +22,7 @@ import time |
| from pylib import android_commands |
| from pylib import constants |
| from pylib import device_settings |
| +from pylib.device import battery_utils |
| from pylib.device import device_blacklist |
| from pylib.device import device_errors |
| from pylib.device import device_utils |
| @@ -165,7 +166,8 @@ def WipeDeviceIfPossible(device, timeout, options): |
| def ChargeDeviceToLevel(device, level): |
| def device_charged(): |
| - battery_level = device.GetBatteryInfo().get('level') |
| + battery = battery_utils.BatteryUtils(device) |
| + battery_level = battery.GetBatteryInfo().get('level') |
| if battery_level is None: |
| logging.warning('Unable to find current battery level.') |
| battery_level = 100 |
| @@ -208,7 +210,8 @@ def ProvisionDevice(device, options): |
| device, device_settings.NETWORK_DISABLED_SETTINGS) |
| if options.min_battery_level is not None: |
| try: |
| - device.SetCharging(True) |
| + battery = battery_utils.BatteryUtils(device) |
|
jbudorick
2015/04/01 17:29:47
Let's just move this into ChargeDeviceToLevel.
rnephew (Wrong account)
2015/04/01 17:42:54
Done.
|
| + battery.SetCharging(True) |
| ChargeDeviceToLevel(device, options.min_battery_level) |
| except device_errors.CommandFailedError as e: |
| logging.exception('Unable to charge device to specified level.') |