| 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 |
| 33 from pylib.device import intent | 34 from pylib.device import intent |
| 34 from pylib.device import logcat_monitor | 35 from pylib.device import logcat_monitor |
| 35 from pylib.device.commands import install_commands | 36 from pylib.device.commands import install_commands |
| 36 from pylib.utils import apk_helper | 37 from pylib.utils import apk_helper |
| 37 from pylib.utils import base_error | 38 from pylib.utils import base_error |
| 38 from pylib.utils import device_temp_file | 39 from pylib.utils import device_temp_file |
| 39 from pylib.utils import host_utils | 40 from pylib.utils import host_utils |
| 40 from pylib.utils import md5sum | 41 from pylib.utils import md5sum |
| 41 from pylib.utils import parallelizer | 42 from pylib.utils import parallelizer |
| 42 from pylib.utils import timeout_retry | 43 from pylib.utils import timeout_retry |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 devices: A list of either DeviceUtils instances or objects from | 1553 devices: A list of either DeviceUtils instances or objects from |
| 1553 from which DeviceUtils instances can be constructed. If None, | 1554 from which DeviceUtils instances can be constructed. If None, |
| 1554 all attached devices will be used. | 1555 all attached devices will be used. |
| 1555 async: If true, returns a Parallelizer that runs operations | 1556 async: If true, returns a Parallelizer that runs operations |
| 1556 asynchronously. | 1557 asynchronously. |
| 1557 | 1558 |
| 1558 Returns: | 1559 Returns: |
| 1559 A Parallelizer operating over |devices|. | 1560 A Parallelizer operating over |devices|. |
| 1560 """ | 1561 """ |
| 1561 if not devices: | 1562 if not devices: |
| 1562 blacklist = device_blacklist.ReadBlacklist() | 1563 devices = adb_wrapper.AdbWrapper.Devices( |
| 1563 devices = [d for d in adb_wrapper.AdbWrapper.GetDevices() | 1564 filters=device_filter.DefaultFilters()) |
| 1564 if d.GetDeviceSerial() not in blacklist] | |
| 1565 if not devices: | 1565 if not devices: |
| 1566 raise device_errors.NoDevicesError() | 1566 raise device_errors.NoDevicesError() |
| 1567 | 1567 |
| 1568 devices = [d if isinstance(d, cls) else cls(d) for d in devices] | 1568 devices = [d if isinstance(d, cls) else cls(d) for d in devices] |
| 1569 if async: | 1569 if async: |
| 1570 return parallelizer.Parallelizer(devices) | 1570 return parallelizer.Parallelizer(devices) |
| 1571 else: | 1571 else: |
| 1572 return parallelizer.SyncParallelizer(devices) | 1572 return parallelizer.SyncParallelizer(devices) |
| 1573 | 1573 |
| 1574 def GetClientCache(self, client_name): | 1574 def GetClientCache(self, client_name): |
| 1575 """Returns client cache.""" | 1575 """Returns client cache.""" |
| 1576 if client_name not in self._client_caches: | 1576 if client_name not in self._client_caches: |
| 1577 self._client_caches[client_name] = {} | 1577 self._client_caches[client_name] = {} |
| 1578 return self._client_caches[client_name] | 1578 return self._client_caches[client_name] |
| 1579 | 1579 |
| 1580 def _ClearCache(self): | 1580 def _ClearCache(self): |
| 1581 """Clears all caches.""" | 1581 """Clears all caches.""" |
| 1582 for client in self._client_caches: | 1582 for client in self._client_caches: |
| 1583 self._client_caches[client].clear() | 1583 self._client_caches[client].clear() |
| 1584 self._cache.clear() | 1584 self._cache.clear() |
| OLD | NEW |