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..9c3d79bc33e5339789a9410324d969e3a51b8b07 100644 |
--- a/build/android/pylib/device/battery_utils.py |
+++ b/build/android/pylib/device/battery_utils.py |
@@ -384,3 +384,20 @@ 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 |
+ |
jbudorick
2015/05/07 00:07:14
nit: log at info level that we're waiting for the
rnephew (Reviews Here)
2015/05/07 01:40:03
Done.
|
+ timeout_retry.WaitFor(cool_device, wait_period=wait_period) |