Index: build/android/pylib/remote/device/remote_device_environment.py |
diff --git a/build/android/pylib/remote/device/remote_device_environment.py b/build/android/pylib/remote/device/remote_device_environment.py |
index 6936bcbd802e7aa3287533f38cfbd4d18f88d7b3..706ff3c55acd6d5f47fa946bd55bfd900035e9a7 100644 |
--- a/build/android/pylib/remote/device/remote_device_environment.py |
+++ b/build/android/pylib/remote/device/remote_device_environment.py |
@@ -62,6 +62,10 @@ class RemoteDeviceEnvironment(environment.Environment): |
self._runner_type = args.runner_type |
self._device = '' |
self._verbose_count = args.verbose_count |
+ if (args.device_type != 'Android' |
+ and args.device_type != "iOS"): |
+ error_func('device-type must be iOS or Android') |
+ self._device_type=args.device_type |
if not args.trigger and not args.collect: |
self._trigger = True |
@@ -128,7 +132,7 @@ class RemoteDeviceEnvironment(environment.Environment): |
device_list = dev_list_res.json()['response'] |
random.shuffle(device_list) |
for device in device_list: |
- if device['os_name'] != 'Android': |
+ if device['os_name'] != self._device_type: |
continue |
if self._remote_device and device['name'] != self._remote_device: |
continue |
@@ -150,9 +154,9 @@ class RemoteDeviceEnvironment(environment.Environment): |
return c |
return 0 |
- logging.critical('Available Android Devices:') |
- android_devices = (d for d in device_list if d['os_name'] == 'Android') |
- for d in sorted(android_devices, compare_devices): |
+ logging.critical('Available %s Devices:', self._device_type) |
+ devices = (d for d in device_list if d['os_name'] == self._device_type) |
+ for d in sorted(devices, compare_devices): |
logging.critical(' %s %s', d['os_version'].ljust(7), d['name']) |
def _NoDeviceFound(self, device_list): |