Index: build/android/pylib/utils/emulator.py |
diff --git a/build/android/pylib/utils/emulator.py b/build/android/pylib/utils/emulator.py |
index 635462f208bed21d53165329c1fd02ec4aa54ef2..26b91098bd0fe72a0717a660e00f1e200d544f63 100644 |
--- a/build/android/pylib/utils/emulator.py |
+++ b/build/android/pylib/utils/emulator.py |
@@ -15,6 +15,7 @@ |
import time |
# TODO(craigdh): Move these pylib dependencies to pylib/utils/. |
+from pylib import android_commands |
from pylib import cmd_helper |
from pylib import constants |
from pylib import pexpect |
@@ -89,14 +90,14 @@ |
running but a device slot is taken. A little bot trouble and and |
we're out of room forever. |
""" |
- emulators = [d for d in device_utils.HealthyDevices() if d.adb.is_emulator] |
+ emulators = android_commands.GetAttachedDevices(hardware=False) |
if not emulators: |
return |
- for e in emulators: |
- e.adb.Emu(['kill']) |
+ for emu_name in emulators: |
+ cmd_helper.RunCmd(['adb', '-s', emu_name, 'emu', 'kill']) |
logging.info('Emulator killing is async; give a few seconds for all to die.') |
for _ in range(5): |
- if not any(d.adb.is_emulator for d in device_utils.HealthyDevices()): |
+ if not android_commands.GetAttachedDevices(hardware=False): |
return |
time.sleep(1) |
@@ -140,9 +141,9 @@ |
def _GetAvailablePort(): |
"""Returns an available TCP port for the console.""" |
used_ports = [] |
- emulators = [d for d in device_utils.HealthyDevices() if d.adb.is_emulator] |
+ emulators = android_commands.GetAttachedDevices(hardware=False) |
for emulator in emulators: |
- used_ports.append(emulator.adb.GetDeviceSerial().split('-')[1]) |
+ used_ports.append(emulator.split('-')[1]) |
for port in PortPool.port_range(): |
if str(port) not in used_ports: |
return port |