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

Unified Diff: adb/contrib/adb_commands_safe.py

Issue 2177573003: Add option to send reboot command and not wait for device. (Closed) Base URL: https://github.com/luci/python-adb.git@master
Patch Set: Created 4 years, 5 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
« adb/common.py ('K') | « adb/common.py ('k') | adb/contrib/high.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: adb/contrib/adb_commands_safe.py
diff --git a/adb/contrib/adb_commands_safe.py b/adb/contrib/adb_commands_safe.py
index 78d2c50d966f16241b335cb2a9194d5e0b249e52..63da67d2e43596329d167e397150ec01a329a3d1 100644
--- a/adb/contrib/adb_commands_safe.py
+++ b/adb/contrib/adb_commands_safe.py
@@ -327,7 +327,7 @@ class AdbCommandsSafe(object):
break
return False
- def Reboot(self):
+ def Reboot(self, wait=True):
"""Reboots the device. Waits for it to be rebooted but not fully
operational.
@@ -340,6 +340,9 @@ class AdbCommandsSafe(object):
Returns True on success.
"""
if self._adb_cmd:
+ if not wait:
+ return self._Reboot()
+
# Get previous uptime to ensure the phone actually rebooted.
previous_uptime = self.GetUptime()
if not previous_uptime:
@@ -387,6 +390,15 @@ class AdbCommandsSafe(object):
break
return False
+ def ResetHandle(self, new_endpoint=None):
M-A Ruel 2016/07/23 00:58:44 Please add a docstring.
bpastene 2016/07/23 01:17:39 Done.
+ if self._adb_cmd:
+ self._adb_cmd.Close()
+ self._adb_cmd = None
+ if new_endpoint:
+ self._serial = None
+ self._handle.Reset(new_endpoint=new_endpoint)
+ return self._Connect(False)
+
def Shell(self, cmd, timeout_ms=None):
"""Runs a command on an Android device while swallowing exceptions.
« adb/common.py ('K') | « adb/common.py ('k') | adb/contrib/high.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698