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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 """ | 630 """ |
631 self._RunDeviceAdbCmd(['forward', '--remove', str(local)], timeout, | 631 self._RunDeviceAdbCmd(['forward', '--remove', str(local)], timeout, |
632 retries) | 632 retries) |
633 | 633 |
634 def ForwardList(self, timeout=DEFAULT_TIMEOUT, retries=DEFAULT_RETRIES): | 634 def ForwardList(self, timeout=DEFAULT_TIMEOUT, retries=DEFAULT_RETRIES): |
635 """List all currently forwarded socket connections. | 635 """List all currently forwarded socket connections. |
636 | 636 |
637 Args: | 637 Args: |
638 timeout: (optional) Timeout per try in seconds. | 638 timeout: (optional) Timeout per try in seconds. |
639 retries: (optional) Number of retries to attempt. | 639 retries: (optional) Number of retries to attempt. |
640 Returns: | |
641 The output of adb forward --list as a string. | |
640 """ | 642 """ |
643 if (distutils.version.LooseVersion(self.Version()) >= | |
644 distutils.version.LooseVersion('1.0.36')): | |
645 # Starting in 1.0.36, this can occasionally fail with a protocol fault. | |
646 # As this interrupts all connections with all devices, we instead just | |
647 # return an empty list. This may give clients an inaccurate result, but | |
648 # that's usually better than crashing the adb server. | |
649 | |
650 # TODO(jbudorick): Determine an appropriate upper version bound for this | |
651 # once b/31811775 is fixed. | |
nednguyen
2016/10/24 12:05:50
Should we remove the bug reference since this is i
jbudorick
2016/10/24 13:46:16
I'd definitely like to leave it here. It's certain
| |
652 return '' | |
653 | |
641 return self._RunDeviceAdbCmd(['forward', '--list'], timeout, retries) | 654 return self._RunDeviceAdbCmd(['forward', '--list'], timeout, retries) |
642 | 655 |
643 def JDWP(self, timeout=DEFAULT_TIMEOUT, retries=DEFAULT_RETRIES): | 656 def JDWP(self, timeout=DEFAULT_TIMEOUT, retries=DEFAULT_RETRIES): |
644 """List of PIDs of processes hosting a JDWP transport. | 657 """List of PIDs of processes hosting a JDWP transport. |
645 | 658 |
646 Args: | 659 Args: |
647 timeout: (optional) Timeout per try in seconds. | 660 timeout: (optional) Timeout per try in seconds. |
648 retries: (optional) Number of retries to attempt. | 661 retries: (optional) Number of retries to attempt. |
649 | 662 |
650 Returns: | 663 Returns: |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 @property | 900 @property |
888 def is_emulator(self): | 901 def is_emulator(self): |
889 return _EMULATOR_RE.match(self._device_serial) | 902 return _EMULATOR_RE.match(self._device_serial) |
890 | 903 |
891 @property | 904 @property |
892 def is_ready(self): | 905 def is_ready(self): |
893 try: | 906 try: |
894 return self.GetState() == _READY_STATE | 907 return self.GetState() == _READY_STATE |
895 except device_errors.CommandFailedError: | 908 except device_errors.CommandFailedError: |
896 return False | 909 return False |
OLD | NEW |