Add context on the ordering of `root_adb` commands. (#624)
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py
index cd0d6a9..cb9ab52 100644
--- a/mobly/controllers/android_device.py
+++ b/mobly/controllers/android_device.py
@@ -457,7 +457,7 @@
self._is_rebooting = False
self.adb = adb.AdbProxy(serial)
self.fastboot = fastboot.FastbootProxy(serial)
- if not self.is_bootloader and self.is_rootable:
+ if self.is_rootable:
self.root_adb()
self.services = service_manager.ServiceManager(self)
self.services.register(SERVICE_NAME_LOGCAT,
@@ -788,7 +788,7 @@
@property
def is_rootable(self):
- return self.build_info['debuggable'] == '1'
+ return not self.is_bootloader and self.build_info['debuggable'] == '1'
@property
def model(self):
@@ -834,6 +834,8 @@
mode per security restrictions.
"""
self.adb.root()
+ # `root` causes the device to temporarily disappear from adb.
+ # So we need to wait for the device to come back before proceeding.
self.adb.wait_for_device(
timeout=DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND)