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

Unified Diff: build/android/pylib/device/device_utils.py

Issue 1282563003: [Android] Convert RestartAdbd to DeviceUtils again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add device test Created 5 years, 4 months 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 | build/android/pylib/device/device_utils_device_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index 2d9671d01034f64873c5c0ebd2b889f0e896703c..348620abb3fc4cb38ac572286eacf042bf8a58f2 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -76,6 +76,16 @@ _CONTROL_CHARGING_COMMANDS = [
},
]
+_RESTART_ADBD_SCRIPT = """
+ trap '' HUP
+ trap '' TERM
+ trap '' PIPE
+ function restart() {
+ stop adbd
+ start adbd
+ }
+ restart &
+"""
_CURRENT_FOCUS_CRASH_RE = re.compile(
r'\s*mCurrentFocus.*Application (Error|Not Responding): (\S+)}')
@@ -1804,3 +1814,11 @@ class DeviceUtils(object):
return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices()
if not blacklisted(adb)]
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def RestartAdbd(self, timeout=None, retries=None):
+ logging.info('Restarting adbd on device.')
+ with device_temp_file.DeviceTempFile(self.adb, suffix='.sh') as script:
+ self.WriteFile(script.name, _RESTART_ADBD_SCRIPT)
+ self.RunShellCommand(['source', script.name], as_root=True)
+ self.adb.WaitForDevice()
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_device_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698