OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
6 | 6 |
7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
8 """ | 8 """ |
9 | 9 |
10 import collections | 10 import collections |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 def StartCrashUploadService(self, package): | 744 def StartCrashUploadService(self, package): |
745 # TODO(frankf): We really need a python wrapper around Intent | 745 # TODO(frankf): We really need a python wrapper around Intent |
746 # to be shared with StartActivity/BroadcastIntent. | 746 # to be shared with StartActivity/BroadcastIntent. |
747 cmd = ( | 747 cmd = ( |
748 'am startservice -a %s.crash.ACTION_FIND_ALL -n ' | 748 'am startservice -a %s.crash.ACTION_FIND_ALL -n ' |
749 '%s/%s.crash.MinidumpUploadService' % | 749 '%s/%s.crash.MinidumpUploadService' % |
750 (constants.PACKAGE_INFO['chrome'].package, | 750 (constants.PACKAGE_INFO['chrome'].package, |
751 package, | 751 package, |
752 constants.PACKAGE_INFO['chrome'].package)) | 752 constants.PACKAGE_INFO['chrome'].package)) |
753 am_output = self.RunShellCommand(cmd) | 753 am_output = self.RunShellCommandWithSU(cmd) |
754 assert am_output and 'Starting' in am_output[-1], 'Service failed to start' | 754 assert am_output and 'Starting' in am_output[-1], ( |
| 755 'Service failed to start: %s' % am_output) |
755 time.sleep(15) | 756 time.sleep(15) |
756 | 757 |
757 def BroadcastIntent(self, package, intent, *args): | 758 def BroadcastIntent(self, package, intent, *args): |
758 """Send a broadcast intent. | 759 """Send a broadcast intent. |
759 | 760 |
760 Args: | 761 Args: |
761 package: Name of package containing the intent. | 762 package: Name of package containing the intent. |
762 intent: Name of the intent. | 763 intent: Name of the intent. |
763 args: Optional extra arguments for the intent. | 764 args: Optional extra arguments for the intent. |
764 """ | 765 """ |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 """ | 1703 """ |
1703 def __init__(self, output): | 1704 def __init__(self, output): |
1704 self._output = output | 1705 self._output = output |
1705 | 1706 |
1706 def write(self, data): | 1707 def write(self, data): |
1707 data = data.replace('\r\r\n', '\n') | 1708 data = data.replace('\r\r\n', '\n') |
1708 self._output.write(data) | 1709 self._output.write(data) |
1709 | 1710 |
1710 def flush(self): | 1711 def flush(self): |
1711 self._output.flush() | 1712 self._output.flush() |
OLD | NEW |