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

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, 9 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 | tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.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..3535c5f754fcdade857edef5ef045180ddd317c5 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,7 @@ def WipeDeviceIfPossible(device, timeout, options):
def ChargeDeviceToLevel(device, level):
nednguyen 2015/04/01 21:22:16 Shouldn't this be a method of BatteryUtils class?
rnephew (Wrong account) 2015/04/01 21:58:11 Good idea, moved.
def device_charged():
- battery_level = device.GetBatteryInfo().get('level')
+ battery_level = battery.GetBatteryInfo().get('level')
if battery_level is None:
logging.warning('Unable to find current battery level.')
battery_level = 100
@@ -174,6 +175,8 @@ def ChargeDeviceToLevel(device, level):
battery_level = int(battery_level)
return battery_level >= level
+ battery = battery_utils.BatteryUtils(device)
+ battery.SetCharging(True)
timeout_retry.WaitFor(device_charged, wait_period=60)
@@ -208,7 +211,6 @@ def ProvisionDevice(device, options):
device, device_settings.NETWORK_DISABLED_SETTINGS)
if options.min_battery_level is not None:
try:
- device.SetCharging(True)
nednguyen 2015/04/01 21:22:15 This removal looks like a functional change.
rnephew (Wrong account) 2015/04/01 21:58:11 It was moved into ChargeDeviceToLevel instead of b
ChargeDeviceToLevel(device, 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 | tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698