Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2553)

Unified Diff: build/android/provision_devices.py

Issue 1057563002: [Android] Convert to BatteryUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/device/battery_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/provision_devices.py
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index 5f00b31e8a817440b99d845b6745401c6d46c947..ad51f039e068af625cd8035e7369b56ed4ada743 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
@@ -163,20 +164,6 @@ def WipeDeviceIfPossible(device, timeout, options):
pass
-def ChargeDeviceToLevel(device, level):
- def device_charged():
- battery_level = device.GetBatteryInfo().get('level')
- if battery_level is None:
- logging.warning('Unable to find current battery level.')
- battery_level = 100
- else:
- logging.info('current battery level: %d', battery_level)
- battery_level = int(battery_level)
- return battery_level >= level
-
- timeout_retry.WaitFor(device_charged, wait_period=60)
-
-
def ProvisionDevice(device, options):
if options.reboot_timeout:
reboot_timeout = options.reboot_timeout
@@ -208,8 +195,8 @@ def ProvisionDevice(device, options):
device, device_settings.NETWORK_DISABLED_SETTINGS)
if options.min_battery_level is not None:
try:
- device.SetCharging(True)
- ChargeDeviceToLevel(device, options.min_battery_level)
+ battery = battery_utils.BatteryUtils(device)
+ battery.ChargeDeviceToLevel(options.min_battery_level)
except device_errors.CommandFailedError as e:
logging.exception('Unable to charge device to specified level.')
« no previous file with comments | « no previous file | build/android/pylib/device/battery_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698