Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Unified Diff: build/android/screenshot.py

Issue 1101603002: [Android] Rework device filtering and add DeviceUtils.HealthyDevices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perezju comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/local/device/local_device_environment.py ('k') | build/android/tombstones.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/screenshot.py
diff --git a/build/android/screenshot.py b/build/android/screenshot.py
index 4c1e247fcef09423c4b183458e005807b07482de..c48a2553fbd0f6ffe967d61bb611b1b1c3559f06 100755
--- a/build/android/screenshot.py
+++ b/build/android/screenshot.py
@@ -12,8 +12,7 @@ import os
import sys
from pylib import screenshot
-from pylib.device import adb_wrapper
-from pylib.device import device_filter
+from pylib.device import device_errors
from pylib.device import device_utils
def _PrintMessage(heading, eol='\n'):
@@ -67,22 +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 = adb_wrapper.AdbWrapper.Devices(
- filters=device_filter.DefaultFilters())
-
- 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)
« no previous file with comments | « build/android/pylib/local/device/local_device_environment.py ('k') | build/android/tombstones.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698