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 272e613b6817f915a2cee039caf6ff53de13bea7..f23e1eaee5b5c2b62d42cba656149f2d74bff8b2 100644 |
--- a/build/android/pylib/device/device_utils.py |
+++ b/build/android/pylib/device/device_utils.py |
@@ -65,8 +65,8 @@ class DeviceUtils(object): |
"""DeviceUtils constructor. |
Args: |
- device: Either a device serial, an existing AdbWrapper instance, an |
- an existing AndroidCommands instance, or nothing. |
+ device: Either a device serial, an existing AdbWrapper instance, or an |
+ an existing AndroidCommands instance. |
default_timeout: An integer containing the default number of seconds to |
wait for an operation to complete if no explicit value |
is provided. |
@@ -85,11 +85,8 @@ class DeviceUtils(object): |
elif isinstance(device, pylib.android_commands.AndroidCommands): |
self.adb = adb_wrapper.AdbWrapper(device.GetDevice()) |
self.old_interface = device |
- elif not device: |
- self.adb = adb_wrapper.AdbWrapper('') |
- self.old_interface = pylib.android_commands.AndroidCommands() |
else: |
- raise ValueError('Unsupported type passed for argument "device"') |
+ raise ValueError('Unsupported device value: %r' % device) |
perezju
2014/11/26 17:53:55
a bit more informative when passing the wrong valu
|
self._commands_installed = None |
self._default_timeout = default_timeout |
self._default_retries = default_retries |
@@ -1132,12 +1129,12 @@ class DeviceUtils(object): |
def __str__(self): |
"""Returns the device serial.""" |
- s = self.old_interface.GetDevice() |
- if not s: |
- s = self.old_interface.Adb().GetSerialNumber() |
- if s == 'unknown': |
- raise device_errors.NoDevicesError() |
- return s |
+ return str(self.adb) |
perezju
2014/11/26 17:53:55
note: maybe self.GetDeviceSerial() might look a bi
jbudorick
2014/11/27 17:01:58
FWIW, "messing up a lot of tests" isn't a great mo
perezju
2014/11/28 16:06:22
Let me rephrase that. I don't think we normally wa
jbudorick
2014/12/01 15:14:23
I can agree with this.
|
+ |
+ @property |
+ def device_serial(self): |
jbudorick
2014/11/27 17:01:58
This is entirely unnecessary between __str__ and A
perezju
2014/11/28 16:06:22
Unnecessary but more readable and explicit, for wh
jbudorick
2014/12/01 15:14:23
I really don't like duplicating functionality betw
|
+ """Returns the device serial.""" |
+ return str(self.adb) |
@staticmethod |
def parallel(devices=None, async=False): |