Chromium Code Reviews| Index: build/android/pylib/device/device_utils.py |
| diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py |
| index ddda0178bc8a60603c0475c4e6f8f005e03b6ddc..2a66736a221653800eb58645e9fe4216d23a932a 100644 |
| --- a/build/android/pylib/device/device_utils.py |
| +++ b/build/android/pylib/device/device_utils.py |
| @@ -30,7 +30,6 @@ from pylib.device import adb_wrapper |
| from pylib.device import decorators |
| from pylib.device import device_blacklist |
| from pylib.device import device_errors |
| -from pylib.device import device_filter |
| from pylib.device import intent |
| from pylib.device import logcat_monitor |
| from pylib.device.commands import install_commands |
| @@ -1542,6 +1541,18 @@ class DeviceUtils(object): |
| return self._cache['run_pie'] |
| + def GetClientCache(self, client_name): |
| + """Returns client cache.""" |
| + if client_name not in self._client_caches: |
| + self._client_caches[client_name] = {} |
| + return self._client_caches[client_name] |
| + |
| + def _ClearCache(self): |
| + """Clears all caches.""" |
| + for client in self._client_caches: |
| + self._client_caches[client].clear() |
| + self._cache.clear() |
| + |
| @classmethod |
| def parallel(cls, devices=None, async=False): |
| """Creates a Parallelizer to operate over the provided list of devices. |
| @@ -1560,8 +1571,7 @@ class DeviceUtils(object): |
| A Parallelizer operating over |devices|. |
| """ |
| if not devices: |
| - devices = adb_wrapper.AdbWrapper.Devices( |
| - filters=device_filter.DefaultFilters()) |
| + devices = cls.HealthyDevices() |
| if not devices: |
| raise device_errors.NoDevicesError() |
| @@ -1571,14 +1581,9 @@ class DeviceUtils(object): |
| else: |
| return parallelizer.SyncParallelizer(devices) |
| - def GetClientCache(self, client_name): |
| - """Returns client cache.""" |
| - if client_name not in self._client_caches: |
| - self._client_caches[client_name] = {} |
| - return self._client_caches[client_name] |
| + @classmethod |
| + def HealthyDevices(cls): |
| + blacklist = device_blacklist.ReadBlacklist() |
| + return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() |
| + if adb.is_ready and not adb.GetDeviceSerial() in blacklist] |
|
perezju
2015/04/24 08:30:31
Having this function was such a great idea! Much c
jbudorick
2015/04/24 15:59:41
done
|
| - def _ClearCache(self): |
| - """Clears all caches.""" |
| - for client in self._client_caches: |
| - self._client_caches[client].clear() |
| - self._cache.clear() |