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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 MD5SUM_LD_LIBRARY_PATH = 'LD_LIBRARY_PATH=%s' % MD5SUM_DEVICE_FOLDER | 66 MD5SUM_LD_LIBRARY_PATH = 'LD_LIBRARY_PATH=%s' % MD5SUM_DEVICE_FOLDER |
67 | 67 |
68 | 68 |
69 def GetAVDs(): | 69 def GetAVDs(): |
70 """Returns a list of AVDs.""" | 70 """Returns a list of AVDs.""" |
71 re_avd = re.compile('^[ ]+Name: ([a-zA-Z0-9_:.-]+)', re.MULTILINE) | 71 re_avd = re.compile('^[ ]+Name: ([a-zA-Z0-9_:.-]+)', re.MULTILINE) |
72 avds = re_avd.findall(cmd_helper.GetCmdOutput(['android', 'list', 'avd'])) | 72 avds = re_avd.findall(cmd_helper.GetCmdOutput(['android', 'list', 'avd'])) |
73 return avds | 73 return avds |
74 | 74 |
75 | 75 |
| 76 def GetEmulators(): |
| 77 """Backwards compatibility call to get emulators. |
| 78 |
| 79 Deprecated: use GetAttachedDevices(hardware=False) instead. |
| 80 """ |
| 81 return GetAttachedDevices(hardware=False) |
| 82 |
76 def GetAttachedDevices(hardware=True, emulator=True, offline=False): | 83 def GetAttachedDevices(hardware=True, emulator=True, offline=False): |
77 """Returns a list of attached, android devices and emulators. | 84 """Returns a list of attached, android devices and emulators. |
78 | 85 |
79 If a preferred device has been set with ANDROID_SERIAL, it will be first in | 86 If a preferred device has been set with ANDROID_SERIAL, it will be first in |
80 the returned list. The arguments specify what devices to include in the list. | 87 the returned list. The arguments specify what devices to include in the list. |
81 | 88 |
82 Example output: | 89 Example output: |
83 | 90 |
84 * daemon not running. starting it now on port 5037 * | 91 * daemon not running. starting it now on port 5037 * |
85 * daemon started successfully * | 92 * daemon started successfully * |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 """ | 1469 """ |
1463 def __init__(self, output): | 1470 def __init__(self, output): |
1464 self._output = output | 1471 self._output = output |
1465 | 1472 |
1466 def write(self, data): | 1473 def write(self, data): |
1467 data = data.replace('\r\r\n', '\n') | 1474 data = data.replace('\r\r\n', '\n') |
1468 self._output.write(data) | 1475 self._output.write(data) |
1469 | 1476 |
1470 def flush(self): | 1477 def flush(self): |
1471 self._output.flush() | 1478 self._output.flush() |
OLD | NEW |