Index: build/android/screenshot.py |
diff --git a/build/android/screenshot.py b/build/android/screenshot.py |
index fb1aee1d985aaedef0c47c22605328ff4ca969bd..74d6856efc67e5ed306a7c4776bc3e4157615dd1 100755 |
--- a/build/android/screenshot.py |
+++ b/build/android/screenshot.py |
@@ -14,6 +14,7 @@ import sys |
from pylib import android_commands |
from pylib import screenshot |
from pylib.device import device_utils |
+from pylib.device import adb_wrapper |
jbudorick
2014/12/16 18:14:20
nit: either switch to adb_wrapper.AdbWrapper.GetDe
Ian Wen
2014/12/16 18:48:37
Done.
|
def _PrintMessage(heading, eol='\n'): |
sys.stdout.write('%s%s' % (heading, eol)) |
@@ -69,9 +70,13 @@ def main(): |
if options.verbose: |
logging.getLogger().setLevel(logging.DEBUG) |
- if not options.device and len(android_commands.GetAttachedDevices()) > 1: |
+ 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] |
if len(args) > 1: |
parser.error('Too many positional arguments.') |