| Index: build/android/screenshot.py
 | 
| diff --git a/build/android/screenshot.py b/build/android/screenshot.py
 | 
| index 8fe2a95ddd9948e783f7c0831abf4deb421fea91..c48a2553fbd0f6ffe967d61bb611b1b1c3559f06 100755
 | 
| --- a/build/android/screenshot.py
 | 
| +++ b/build/android/screenshot.py
 | 
| @@ -11,8 +11,8 @@ import optparse
 | 
|  import os
 | 
|  import sys
 | 
|  
 | 
| -from pylib import android_commands
 | 
|  from pylib import screenshot
 | 
| +from pylib.device import device_errors
 | 
|  from pylib.device import device_utils
 | 
|  
 | 
|  def _PrintMessage(heading, eol='\n'):
 | 
| @@ -66,21 +66,25 @@ def main():
 | 
|  
 | 
|    (options, args) = parser.parse_args()
 | 
|  
 | 
| +  if len(args) > 1:
 | 
| +    parser.error('Too many positional arguments.')
 | 
| +  host_file = args[0] if args else options.file
 | 
| +
 | 
|    if options.verbose:
 | 
|      logging.getLogger().setLevel(logging.DEBUG)
 | 
|  
 | 
| -  devices = android_commands.GetAttachedDevices()
 | 
| -
 | 
| -  if not options.device and len(devices) > 1:
 | 
| -    parser.error('Multiple devices are attached. '
 | 
| -                 'Please specify device serial number with --device.')
 | 
| -  elif not options.device and len(devices) == 1:
 | 
| -    options.device = devices[0]
 | 
| +  devices = device_utils.DeviceUtils.HealthyDevices()
 | 
|  
 | 
| -  if len(args) > 1:
 | 
| -    parser.error('Too many positional arguments.')
 | 
| -  host_file = args[0] if args else options.file
 | 
| -  device = device_utils.DeviceUtils(options.device)
 | 
| +  if not options.device:
 | 
| +    if len(devices) > 1:
 | 
| +      parser.error('Multiple devices are attached. '
 | 
| +                   'Please specify device serial number with --device.')
 | 
| +    elif len(devices) == 1:
 | 
| +      device = devices[0]
 | 
| +    else:
 | 
| +      raise device_errors.NoDevicesError()
 | 
| +  else:
 | 
| +    device = device_utils.DeviceUtils(options.device)
 | 
|  
 | 
|    if options.video:
 | 
|      _CaptureVideo(device, host_file, options)
 | 
| 
 |