Chromium Code Reviews| Index: build/android/provision_devices.py |
| diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py |
| index 8433e01d7bec58ee6b781346544b2782ec14ac3b..b8f116fe242450a043f602df44d2b392bb4a6914 100755 |
| --- a/build/android/provision_devices.py |
| +++ b/build/android/provision_devices.py |
| @@ -147,11 +147,30 @@ def ProvisionDevices(options): |
| _ConfigureLocalProperties(device) |
| device_settings.ConfigureContentSettingsDict( |
| device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) |
| - # TODO(tonyg): We eventually want network on. However, currently radios |
| - # can cause perfbots to drain faster than they charge. |
| if 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower(): |
| + # TODO(tonyg): We eventually want network on. However, currently radios |
| + # can cause perfbots to drain faster than they charge. |
| device_settings.ConfigureContentSettingsDict( |
| device, device_settings.NETWORK_DISABLED_SETTINGS) |
| + # Some perf bots run benchmarks with USB charging disabled which leads |
|
jbudorick
2014/06/13 16:43:56
Would we want to try to enable USB charging here i
|
| + # to gradual draining of the battery. We must wait for a full charge |
| + # before starting a run in order to keep the devices online. |
| + try: |
| + battery_info = device_adb.old_interface.GetBatteryInfo() |
| + except Exception as e: |
| + battery_info = {} |
| + logging.error('Unable to obtain battery info for %s, %s', serial, e) |
| + |
| + while int(battery_info.get('level', 0)) < 95: |
| + if (not battery_info.get('AC powered', None) == 'true' and |
| + not battery_info.get('USB powered', None) == 'true' and |
| + not battery_info.get('Wireless powered', None) == 'true'): |
| + logging.error('Device is not charging') |
| + break |
| + logging.info('Waiting for device to charge. Current level=', |
| + battery_info.get('level', 0)) |
| + time.sleep(60) |
| + battery_info = device.old_interface.GetBatteryInfo() |
| device.old_interface.RunShellCommandWithSU('date -u %f' % time.time()) |
| try: |
| device_utils.DeviceUtils.parallel(devices).Reboot(True) |