Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 """ | 448 """ |
| 449 def cool_device(): | 449 def cool_device(): |
| 450 temp = self.GetBatteryInfo().get('temperature') | 450 temp = self.GetBatteryInfo().get('temperature') |
| 451 if temp is None: | 451 if temp is None: |
| 452 logging.warning('Unable to find current battery temperature.') | 452 logging.warning('Unable to find current battery temperature.') |
| 453 temp = 0 | 453 temp = 0 |
| 454 else: | 454 else: |
| 455 logging.info('Current battery temperature: %s', temp) | 455 logging.info('Current battery temperature: %s', temp) |
| 456 return int(temp) <= target_temp | 456 return int(temp) <= target_temp |
| 457 | 457 |
| 458 self._device.RunShellCommand( | |
|
jbudorick
2015/07/01 23:23:32
EnableBatteryUpdates?
Also, if battery updates ar
rnephew (Reviews Here)
2015/07/01 23:28:42
I think we can view this like the charging command
| |
| 459 ['dumpsys', 'battery', 'reset'], check_return=True) | |
| 458 logging.info('Waiting for the device to cool down to %s (0.1 C)', | 460 logging.info('Waiting for the device to cool down to %s (0.1 C)', |
| 459 target_temp) | 461 target_temp) |
| 460 timeout_retry.WaitFor(cool_device, wait_period=wait_period) | 462 timeout_retry.WaitFor(cool_device, wait_period=wait_period) |
| 461 | 463 |
| 462 @decorators.WithTimeoutAndRetriesFromInstance() | 464 @decorators.WithTimeoutAndRetriesFromInstance() |
| 463 def TieredSetCharging(self, enabled, timeout=None, retries=None): | 465 def TieredSetCharging(self, enabled, timeout=None, retries=None): |
| 464 """Enables or disables charging on the device. | 466 """Enables or disables charging on the device. |
| 465 | 467 |
| 466 Args: | 468 Args: |
| 467 enabled: A boolean indicating whether charging should be enabled or | 469 enabled: A boolean indicating whether charging should be enabled or |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 self._cache['profile'] = { | 573 self._cache['profile'] = { |
| 572 'name': None, | 574 'name': None, |
| 573 'witness_file': None, | 575 'witness_file': None, |
| 574 'enable_command': None, | 576 'enable_command': None, |
| 575 'disable_command': None, | 577 'disable_command': None, |
| 576 'charge_counter': None, | 578 'charge_counter': None, |
| 577 'voltage': None, | 579 'voltage': None, |
| 578 'current': None, | 580 'current': None, |
| 579 } | 581 } |
| 580 return False | 582 return False |
| OLD | NEW |