Index: build/android/pylib/device/device_filter.py |
diff --git a/build/android/pylib/device/device_filter.py b/build/android/pylib/device/device_filter.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..189a6198897bb1f04f066158258c3a126bffd6eb |
--- /dev/null |
+++ b/build/android/pylib/device/device_filter.py |
@@ -0,0 +1,26 @@ |
+# Copyright 2015 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+from pylib.device import device_blacklist |
+from pylib.device import device_errors |
+ |
+ |
+def DefaultFilters(): |
+ return [DeviceFilter, BlacklistFilter()] |
+ |
+ |
+def BlacklistFilter(): |
+ blacklist = set(device_blacklist.ReadBlacklist()) |
+ def f(adb): |
+ return adb.GetDeviceSerial() not in blacklist |
+ |
+ return f |
+ |
+ |
+def DeviceFilter(adb): |
+ try: |
+ return adb.GetState() == 'device' |
+ except device_errors.CommandFailedError: |
+ return False |
+ |