Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: telemetry/telemetry/internal/platform/android_device.py

Issue 2487493002: Revert of [Telemetry] Remove the logic of killing stray adb processes (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698