Index: build/android/screenshot.py |
diff --git a/build/android/screenshot.py b/build/android/screenshot.py |
index c48a2553fbd0f6ffe967d61bb611b1b1c3559f06..097739fb62deb0667141e2fe16e9533f678757b0 100755 |
--- a/build/android/screenshot.py |
+++ b/build/android/screenshot.py |
@@ -74,8 +74,11 @@ def main(): |
logging.getLogger().setLevel(logging.DEBUG) |
devices = device_utils.DeviceUtils.HealthyDevices() |
- |
- if not options.device: |
+ if options.device: |
+ device = next((d for d in devices if d == options.device), None) |
+ if not device: |
+ raise device_errors.DeviceUnreachableError(options.device) |
+ else: |
if len(devices) > 1: |
parser.error('Multiple devices are attached. ' |
'Please specify device serial number with --device.') |
@@ -83,8 +86,6 @@ def main(): |
device = devices[0] |
else: |
raise device_errors.NoDevicesError() |
- else: |
- device = device_utils.DeviceUtils(options.device) |
if options.video: |
_CaptureVideo(device, host_file, options) |