Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index 55b3fd6c04e7e306d963dab4ca01070f77e3942f..67275a4d55c4e21cb572d6038191fd1ee9f6d688 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -215,6 +215,15 @@ class AndroidCommands(object): |
"""Returns our AdbInterface to avoid us wrapping all its methods.""" |
return self._adb |
+ def IsOnline(self): |
+ """Checks whether the device is online. |
+ |
+ Returns: |
+ True if device is in 'device' mode, False otherwise. |
+ """ |
+ out = self._adb.SendCommand('get-state') |
+ return out.strip() == 'device' |
+ |
def IsRootEnabled(self): |
"""Checks if root is enabled on the device.""" |
root_test_output = self.RunShellCommand('ls /root') or [''] |