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