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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides a variety of device interactions with power. 5 """Provides a variety of device interactions with power.
6 """ 6 """
7 # pylint: disable=unused-argument 7 # pylint: disable=unused-argument
8 8
9 import collections 9 import collections
10 import contextlib 10 import contextlib
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 battery_level = self.GetBatteryInfo().get('level') 377 battery_level = self.GetBatteryInfo().get('level')
378 if battery_level is None: 378 if battery_level is None:
379 logging.warning('Unable to find current battery level.') 379 logging.warning('Unable to find current battery level.')
380 battery_level = 100 380 battery_level = 100
381 else: 381 else:
382 logging.info('current battery level: %s', battery_level) 382 logging.info('current battery level: %s', battery_level)
383 battery_level = int(battery_level) 383 battery_level = int(battery_level)
384 return battery_level >= level 384 return battery_level >= level
385 385
386 timeout_retry.WaitFor(device_charged, wait_period=wait_period) 386 timeout_retry.WaitFor(device_charged, wait_period=wait_period)
387
388 def LetBatteryCoolToTemperature(self, target_temp, wait_period=60):
389 """Lets device sit to give battery time to cool down
390 Args:
391 temp: maximum temperature to allow in tenths of degrees c.
392 wait_period: time in seconds to wait between checking.
393 """
394 def cool_device():
395 temp = self.GetBatteryInfo().get('temperature')
396 if temp is None:
397 logging.warning('Unable to find current battery temperature.')
398 temp = 0
399 else:
400 logging.info('Current battery temperature: %s', temp)
401 return int(temp) <= target_temp
402
403 logging.info('Waiting for the device to cool down to %s degrees.',
404 target_temp)
405 timeout_retry.WaitFor(cool_device, wait_period=wait_period)
OLDNEW
« 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