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 # pylint: disable-all | 9 # pylint: disable-all |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 # Pattern to search for the next whole line of pexpect output and capture it | 44 # Pattern to search for the next whole line of pexpect output and capture it |
45 # into a match group. We can't use ^ and $ for line start end with pexpect, | 45 # into a match group. We can't use ^ and $ for line start end with pexpect, |
46 # see http://www.noah.org/python/pexpect/#doc for explanation why. | 46 # see http://www.noah.org/python/pexpect/#doc for explanation why. |
47 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r') | 47 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r') |
48 | 48 |
49 # Set the adb shell prompt to be a unique marker that will [hopefully] not | 49 # Set the adb shell prompt to be a unique marker that will [hopefully] not |
50 # appear at the start of any line of a command's output. | 50 # appear at the start of any line of a command's output. |
51 SHELL_PROMPT = '~+~PQ\x17RS~+~' | 51 SHELL_PROMPT = '~+~PQ\x17RS~+~' |
52 | 52 |
53 # Java properties file | 53 # Java properties file |
54 LOCAL_PROPERTIES_PATH = '/data/local.prop' | 54 LOCAL_PROPERTIES_PATH = constants.DEVICE_LOCAL_PROPERTIES_PATH |
55 | 55 |
56 # Property in /data/local.prop that controls Java assertions. | 56 # Property in /data/local.prop that controls Java assertions. |
57 JAVA_ASSERT_PROPERTY = 'dalvik.vm.enableassertions' | 57 JAVA_ASSERT_PROPERTY = 'dalvik.vm.enableassertions' |
58 | 58 |
59 MEMORY_INFO_RE = re.compile('^(?P<key>\w+):\s+(?P<usage_kb>\d+) kB$') | 59 MEMORY_INFO_RE = re.compile('^(?P<key>\w+):\s+(?P<usage_kb>\d+) kB$') |
60 NVIDIA_MEMORY_INFO_RE = re.compile('^\s*(?P<user>\S+)\s*(?P<name>\S+)\s*' | 60 NVIDIA_MEMORY_INFO_RE = re.compile('^\s*(?P<user>\S+)\s*(?P<name>\S+)\s*' |
61 '(?P<pid>\d+)\s*(?P<usage_bytes>\d+)$') | 61 '(?P<pid>\d+)\s*(?P<usage_bytes>\d+)$') |
62 | 62 |
63 # Keycode "enum" suitable for passing to AndroidCommands.SendKey(). | 63 # Keycode "enum" suitable for passing to AndroidCommands.SendKey(). |
64 KEYCODE_HOME = 3 | 64 KEYCODE_HOME = 3 |
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 """ | 1882 """ |
1883 def __init__(self, output): | 1883 def __init__(self, output): |
1884 self._output = output | 1884 self._output = output |
1885 | 1885 |
1886 def write(self, data): | 1886 def write(self, data): |
1887 data = data.replace('\r\r\n', '\n') | 1887 data = data.replace('\r\r\n', '\n') |
1888 self._output.write(data) | 1888 self._output.write(data) |
1889 | 1889 |
1890 def flush(self): | 1890 def flush(self): |
1891 self._output.flush() | 1891 self._output.flush() |
OLD | NEW |