| Index: telemetry/telemetry/internal/platform/android_device.py
|
| diff --git a/telemetry/telemetry/internal/platform/android_device.py b/telemetry/telemetry/internal/platform/android_device.py
|
| index d99caedf82c151f9e930a325da9a1daa4a977939..79345a6cbd9139df29acd7c29238c1d576cbecf3 100644
|
| --- a/telemetry/telemetry/internal/platform/android_device.py
|
| +++ b/telemetry/telemetry/internal/platform/android_device.py
|
| @@ -4,6 +4,7 @@
|
|
|
| import logging
|
| import os
|
| +import subprocess
|
|
|
| from telemetry.core import util
|
| from telemetry.internal.platform import cros_device
|
| @@ -14,6 +15,16 @@
|
| from devil.android import device_errors
|
| from devil.android import device_utils
|
| from devil.android.sdk import adb_wrapper
|
| +
|
| +
|
| +def _KillStrayADBProcesses():
|
| + p = subprocess.Popen(['killall', 'adb'])
|
| + p.communicate()
|
| + if p.returncode:
|
| + logging.info('No adb process was killed')
|
| + else:
|
| + logging.info('Some adb process was killed')
|
| +
|
|
|
|
|
| class AndroidDevice(device.Device):
|
| @@ -59,7 +70,12 @@
|
| the returned list. The arguments specify what devices to include in the list.
|
| """
|
|
|
| - device_serials = _ListSerialsOfHealthyOnlineDevices(blacklist)
|
| + try:
|
| + device_serials = _ListSerialsOfHealthyOnlineDevices(blacklist)
|
| + # Sometimes stray adb processes can interfere with using adb.
|
| + except device_errors.AdbCommandFailedError:
|
| + _KillStrayADBProcesses()
|
| + device_serials = _ListSerialsOfHealthyOnlineDevices(blacklist)
|
|
|
| # The monsoon provides power for the device, so for devices with no
|
| # real battery, we need to turn them on after the monsoon enables voltage
|
|
|