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

Unified Diff: build/android/pylib/android_commands.py

Issue 19284009: Add option to output device status data in format for dashboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make dashboard printing block optional part of device_status_check step. Created 7 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
« no previous file with comments | « build/android/device_status_check.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/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 48116b88ffd8e7e7a889ea679ff99e55569e702c..c7be5e18f46c852cb84210abde89a7efb04b18df 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -114,7 +114,18 @@ def GetAttachedDevices():
return devices
+def GetAttachedOfflineDevices():
+ """Returns a list of attached, offline android devices.
+
+ Returns: List of devices with status 'offline'.
+ """
+ re_device = re.compile('^([a-zA-Z0-9_:.-]+)\toffline$', re.MULTILINE)
+ return re_device.findall(cmd_helper.GetCmdOutput([constants.ADB_PATH,
+ 'devices']))
+
+
def IsDeviceAttached(device):
+ """Return true if the device is attached and online."""
return device in GetAttachedDevices()
@@ -331,6 +342,10 @@ class AndroidCommands(object):
self.WaitForDevicePm()
self.WaitForSdCardReady(timeout)
+ def Shutdown(self):
+ """Shuts down the device."""
+ self._adb.SendCommand('reboot -p')
+
def Uninstall(self, package):
"""Uninstalls the specified package from the device.
@@ -920,6 +935,24 @@ class AndroidCommands(object):
assert build_type
return build_type
+ def GetBuildProduct(self):
+ """Returns the build product of the device (e.g. maguro)."""
+ build_product = self.RunShellCommand('getprop ro.build.product')[0]
+ assert build_product
+ return build_product
+
+ def GetProductName(self):
+ """Returns the product name of the device (e.g. takju)."""
+ name = self.RunShellCommand('getprop ro.product.name')[0]
+ assert name
+ return name
+
+ def GetBuildFingerprint(self):
+ """Returns the build fingerprint of the device."""
+ build_fingerprint = self.RunShellCommand('getprop ro.build.fingerprint')[0]
+ assert build_fingerprint
+ return build_fingerprint
+
def GetDescription(self):
"""Returns the description of the system.
@@ -935,6 +968,30 @@ class AndroidCommands(object):
assert model
return model
+ def GetWifiIP(self):
+ """Returns the wifi IP on the device."""
+ wifi_ip = self.RunShellCommand('getprop dhcp.wlan0.ipaddress')[0]
+ assert wifi_ip
+ return wifi_ip
+
+ def GetSubscriberInfo(self):
+ """Returns the device subscriber info (e.g. GSM and device ID) as string."""
+ iphone_sub = self.RunShellCommand('dumpsys iphonesubinfo')
+ assert iphone_sub
+ return '\n'.join(iphone_sub)
+
+ def GetBatteryInfo(self):
+ """Returns the device battery info (e.g. status, level, etc) as string."""
+ battery = self.RunShellCommand('dumpsys battery')
+ assert battery
+ return '\n'.join(battery)
+
+ def GetSetupWizardStatus(self):
+ """Returns the status of the device setup wizard (e.g. DISABLED)."""
+ status = self.RunShellCommand('getprop ro.setupwizard.mode')[0]
+ assert status
+ return status
+
def StartMonitoringLogcat(self, clear=True, logfile=None, filters=None):
"""Starts monitoring the output of logcat, for use with WaitForLogMatch.
« no previous file with comments | « build/android/device_status_check.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698