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

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

Issue 255783008: Add option to wipe device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove automatic wipe, and add option for manual wipe. Created 6 years, 7 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
« build/android/provision_devices.py ('K') | « build/android/provision_devices.py ('k') | no next file » | 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 c8a5c3a48124107fe9142489c6cf999e4d143eb4..873daaa4bd42af251012744833b1dd8da1e27db9 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -8,6 +8,7 @@ Provides a variety of device interactions based on adb.
Eventually, this will be based on adb_wrapper.
"""
+import multiprocessing
import pylib.android_commands
from pylib.device import adb_wrapper
@@ -16,6 +17,33 @@ def GetAVDs():
return pylib.android_commands.GetAVDs()
+# multiprocessing map_async requires a top-level function for pickle library.
+def RebootDeviceSafe(device):
+ """Reboot a device, wait for it to start, and squelch timeout exceptions."""
+ try:
+ DeviceUtils(device).old_interface.Reboot(True)
+ except Exception as e:
dnj 2014/05/08 15:18:16 The original one explicitly catches DeviceUnrespon
navabi 2014/05/08 19:10:52 Done.
+ return e
+
+
+def RebootDevices():
+ """Reboot all attached and online devices."""
+ devices = pylib.android_commands.GetAttachedDevices()
+ print 'Rebooting: %s' % devices
+ if devices:
+ pool = multiprocessing.Pool(len(devices))
+ results = pool.map_async(RebootDeviceSafe, devices).get(99999)
+
+ for device, result in zip(devices, results):
+ if result:
+ print '%s failed to startup.' % device
+
+ if any(results):
+ print 'RebootDevices() Warning: %s' % results
+ else:
+ print 'Reboots complete.'
+
+
class DeviceUtils(object):
def __init__(self, device):
« build/android/provision_devices.py ('K') | « build/android/provision_devices.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698