| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Provides a variety of device interactions based on adb. | 5 """Provides a variety of device interactions based on adb. |
| 6 | 6 |
| 7 Eventually, this will be based on adb_wrapper. | 7 Eventually, this will be based on adb_wrapper. |
| 8 """ | 8 """ |
| 9 # pylint: disable=unused-argument | 9 # pylint: disable=unused-argument |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import zipfile | 23 import zipfile |
| 24 | 24 |
| 25 import pylib.android_commands | 25 import pylib.android_commands |
| 26 from pylib import cmd_helper | 26 from pylib import cmd_helper |
| 27 from pylib import constants | 27 from pylib import constants |
| 28 from pylib import device_signal | 28 from pylib import device_signal |
| 29 from pylib.device import adb_wrapper | 29 from pylib.device import adb_wrapper |
| 30 from pylib.device import decorators | 30 from pylib.device import decorators |
| 31 from pylib.device import device_blacklist | 31 from pylib.device import device_blacklist |
| 32 from pylib.device import device_errors | 32 from pylib.device import device_errors |
| 33 from pylib.device import device_filter | |
| 34 from pylib.device import intent | 33 from pylib.device import intent |
| 35 from pylib.device import logcat_monitor | 34 from pylib.device import logcat_monitor |
| 36 from pylib.device.commands import install_commands | 35 from pylib.device.commands import install_commands |
| 37 from pylib.utils import apk_helper | 36 from pylib.utils import apk_helper |
| 38 from pylib.utils import base_error | 37 from pylib.utils import base_error |
| 39 from pylib.utils import device_temp_file | 38 from pylib.utils import device_temp_file |
| 40 from pylib.utils import host_utils | 39 from pylib.utils import host_utils |
| 41 from pylib.utils import md5sum | 40 from pylib.utils import md5sum |
| 42 from pylib.utils import parallelizer | 41 from pylib.utils import parallelizer |
| 43 from pylib.utils import timeout_retry | 42 from pylib.utils import timeout_retry |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 devices: A list of either DeviceUtils instances or objects from | 1520 devices: A list of either DeviceUtils instances or objects from |
| 1522 from which DeviceUtils instances can be constructed. If None, | 1521 from which DeviceUtils instances can be constructed. If None, |
| 1523 all attached devices will be used. | 1522 all attached devices will be used. |
| 1524 async: If true, returns a Parallelizer that runs operations | 1523 async: If true, returns a Parallelizer that runs operations |
| 1525 asynchronously. | 1524 asynchronously. |
| 1526 | 1525 |
| 1527 Returns: | 1526 Returns: |
| 1528 A Parallelizer operating over |devices|. | 1527 A Parallelizer operating over |devices|. |
| 1529 """ | 1528 """ |
| 1530 if not devices: | 1529 if not devices: |
| 1531 devices = adb_wrapper.AdbWrapper.Devices( | 1530 blacklist = device_blacklist.ReadBlacklist() |
| 1532 filters=device_filter.DefaultFilters()) | 1531 devices = [d for d in adb_wrapper.AdbWrapper.GetDevices() |
| 1532 if d.GetDeviceSerial() not in blacklist] |
| 1533 if not devices: | 1533 if not devices: |
| 1534 raise device_errors.NoDevicesError() | 1534 raise device_errors.NoDevicesError() |
| 1535 | 1535 |
| 1536 devices = [d if isinstance(d, cls) else cls(d) for d in devices] | 1536 devices = [d if isinstance(d, cls) else cls(d) for d in devices] |
| 1537 if async: | 1537 if async: |
| 1538 return parallelizer.Parallelizer(devices) | 1538 return parallelizer.Parallelizer(devices) |
| 1539 else: | 1539 else: |
| 1540 return parallelizer.SyncParallelizer(devices) | 1540 return parallelizer.SyncParallelizer(devices) |
| 1541 | 1541 |
| 1542 def GetClientCache(self, client_name): | 1542 def GetClientCache(self, client_name): |
| 1543 """Returns client cache.""" | 1543 """Returns client cache.""" |
| 1544 if client_name not in self._client_caches: | 1544 if client_name not in self._client_caches: |
| 1545 self._client_caches[client_name] = {} | 1545 self._client_caches[client_name] = {} |
| 1546 return self._client_caches[client_name] | 1546 return self._client_caches[client_name] |
| 1547 | 1547 |
| 1548 def _ClearCache(self): | 1548 def _ClearCache(self): |
| 1549 """Clears all caches.""" | 1549 """Clears all caches.""" |
| 1550 for client in self._client_caches: | 1550 for client in self._client_caches: |
| 1551 self._client_caches[client].clear() | 1551 self._client_caches[client].clear() |
| 1552 self._cache.clear() | 1552 self._cache.clear() |
| OLD | NEW |