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

Unified Diff: build/android/pylib/device/battery_utils.py

Issue 1126143004: [Android] Add option to wait for battery temperature to device provisioning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « build/android/provision_devices.py ('k') | build/android/pylib/device/battery_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/battery_utils.py
diff --git a/build/android/pylib/device/battery_utils.py b/build/android/pylib/device/battery_utils.py
index cca2cf92cfdcc1f83b923ef4f0a331189b61ba39..ed66591daa5c6ac2df287ffaca938020d47fa37e 100644
--- a/build/android/pylib/device/battery_utils.py
+++ b/build/android/pylib/device/battery_utils.py
@@ -384,3 +384,22 @@ class BatteryUtils(object):
return battery_level >= level
timeout_retry.WaitFor(device_charged, wait_period=wait_period)
+
+ def LetBatteryCoolToTemperature(self, target_temp, wait_period=60):
+ """Lets device sit to give battery time to cool down
+ Args:
+ temp: maximum temperature to allow in tenths of degrees c.
+ wait_period: time in seconds to wait between checking.
+ """
+ def cool_device():
+ temp = self.GetBatteryInfo().get('temperature')
+ if temp is None:
+ logging.warning('Unable to find current battery temperature.')
+ temp = 0
+ else:
+ logging.info('Current battery temperature: %s', temp)
+ return int(temp) <= target_temp
+
+ logging.info('Waiting for the device to cool down to %s degrees.',
+ target_temp)
+ timeout_retry.WaitFor(cool_device, wait_period=wait_period)
« no previous file with comments | « build/android/provision_devices.py ('k') | build/android/pylib/device/battery_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698