| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """This module wraps Android's adb tool. | 5 """This module wraps Android's adb tool. |
| 6 | 6 |
| 7 This is a thin wrapper around the adb interface. Any additional complexity | 7 This is a thin wrapper around the adb interface. Any additional complexity |
| 8 should be delegated to a higher level (ex. DeviceUtils). | 8 should be delegated to a higher level (ex. DeviceUtils). |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 # pylint: enable=unused-argument | 74 # pylint: enable=unused-argument |
| 75 | 75 |
| 76 # pylint: disable=unused-argument | 76 # pylint: disable=unused-argument |
| 77 @classmethod | 77 @classmethod |
| 78 @decorators.WithTimeoutAndRetries | 78 @decorators.WithTimeoutAndRetries |
| 79 def _RunAdbCmd(cls, args, timeout=None, retries=None, device_serial=None, | 79 def _RunAdbCmd(cls, args, timeout=None, retries=None, device_serial=None, |
| 80 check_error=True, cpu_affinity=None): | 80 check_error=True, cpu_affinity=None): |
| 81 # pylint: disable=no-member | 81 # pylint: disable=no-member |
| 82 status, output = cmd_helper.GetCmdStatusAndOutputWithTimeout( | 82 status, output = cmd_helper.GetCmdStatusAndOutputWithTimeout( |
| 83 cls._BuildAdbCmd(args, device_serial, cpu_affinity=cpu_affinity), | 83 cls._BuildAdbCmd(args, device_serial, cpu_affinity=cpu_affinity), |
| 84 timeout_retry.CurrentTimeoutThread().GetRemainingTime()) | 84 timeout_retry.CurrentTimeoutThreadGroup().GetRemainingTime()) |
| 85 if status != 0: | 85 if status != 0: |
| 86 raise device_errors.AdbCommandFailedError( | 86 raise device_errors.AdbCommandFailedError( |
| 87 args, output, status, device_serial) | 87 args, output, status, device_serial) |
| 88 # This catches some errors, including when the device drops offline; | 88 # This catches some errors, including when the device drops offline; |
| 89 # unfortunately adb is very inconsistent with error reporting so many | 89 # unfortunately adb is very inconsistent with error reporting so many |
| 90 # command failures present differently. | 90 # command failures present differently. |
| 91 if check_error and output.startswith('error:'): | 91 if check_error and output.startswith('error:'): |
| 92 raise device_errors.AdbCommandFailedError(args, output) | 92 raise device_errors.AdbCommandFailedError(args, output) |
| 93 return output | 93 return output |
| 94 # pylint: enable=unused-argument | 94 # pylint: enable=unused-argument |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 @property | 655 @property |
| 656 def is_emulator(self): | 656 def is_emulator(self): |
| 657 return _EMULATOR_RE.match(self._device_serial) | 657 return _EMULATOR_RE.match(self._device_serial) |
| 658 | 658 |
| 659 @property | 659 @property |
| 660 def is_ready(self): | 660 def is_ready(self): |
| 661 try: | 661 try: |
| 662 return self.GetState() == _READY_STATE | 662 return self.GetState() == _READY_STATE |
| 663 except device_errors.CommandFailedError: | 663 except device_errors.CommandFailedError: |
| 664 return False | 664 return False |
| OLD | NEW |