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 | |
83 def GetAttachedDevices(hardware=True, emulator=True, offline=False): | 76 def GetAttachedDevices(hardware=True, emulator=True, offline=False): |
84 """Returns a list of attached, android devices and emulators. | 77 """Returns a list of attached, android devices and emulators. |
85 | 78 |
86 If a preferred device has been set with ANDROID_SERIAL, it will be first in | 79 If a preferred device has been set with ANDROID_SERIAL, it will be first in |
87 the returned list. The arguments specify what devices to include in the list. | 80 the returned list. The arguments specify what devices to include in the list. |
88 | 81 |
89 Example output: | 82 Example output: |
90 | 83 |
91 * daemon not running. starting it now on port 5037 * | 84 * daemon not running. starting it now on port 5037 * |
92 * daemon started successfully * | 85 * daemon started successfully * |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 """ | 1462 """ |
1470 def __init__(self, output): | 1463 def __init__(self, output): |
1471 self._output = output | 1464 self._output = output |
1472 | 1465 |
1473 def write(self, data): | 1466 def write(self, data): |
1474 data = data.replace('\r\r\n', '\n') | 1467 data = data.replace('\r\r\n', '\n') |
1475 self._output.write(data) | 1468 self._output.write(data) |
1476 | 1469 |
1477 def flush(self): | 1470 def flush(self): |
1478 self._output.flush() | 1471 self._output.flush() |
OLD | NEW |