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

Unified Diff: build/android/pylib/device/device_filter.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/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index 8e54b2597635d8762fb9a52dcbf3ade0814a9734..0000000000000000000000000000000000000000
--- a/build/android/pylib/device/device_filter.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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():
- """Returns a list of the most commonly-used device filters.
-
- These filters match devices that:
- - are in a "device" state (as opposed to, e.g., "unauthorized" or
- "emulator")
- - are not blacklisted.
-
- Returns:
- A list of the most commonly-used device filters.
- """
- return [DeviceFilter, BlacklistFilter()]
-
-
-def BlacklistFilter():
- """Returns a filter that matches devices that are not blacklisted.
-
- Note that this function is not the filter. It creates one when called using
- the blacklist at that time and returns that.
-
- Returns:
- A filter function that matches devices that are not blacklisted.
- """
- blacklist = set(device_blacklist.ReadBlacklist())
- def f(adb):
- return adb.GetDeviceSerial() not in blacklist
-
- return f
-
-
-def DeviceFilter(adb):
- """A filter that matches devices in a "device" state.
-
- (Basically, this is adb get-state == "device")
-
- Args:
- adb: An instance of AdbWrapper.
- Returns:
- True if the device is in a "device" state.
- """
- try:
- return adb.GetState() == 'device'
- except device_errors.CommandFailedError:
- return False
-
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698