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

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

Issue 420273006: [Android] Fix DeviceUtils.__str__ when no serial is provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/pylib/device/device_errors.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | 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 997405a07d6e570d425ceeacbfe382a7c238becb..8a8de22519f3d69bc93681657494ed076eaeba05 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -790,7 +790,12 @@ class DeviceUtils(object):
def __str__(self):
"""Returns the device serial."""
- return self.old_interface.GetDevice()
+ s = self.old_interface.GetDevice()
+ if not s:
+ s = self.old_interface.Adb().GetSerialNumber()
+ if s == 'unknown':
+ raise device_errors.NoDevicesError()
+ return s
@staticmethod
def parallel(devices=None, async=False):
« no previous file with comments | « build/android/pylib/device/device_errors.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698