| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 Raises: | 283 Raises: |
| 284 CommandFailedError if root could not be enabled. | 284 CommandFailedError if root could not be enabled. |
| 285 CommandTimeoutError on timeout. | 285 CommandTimeoutError on timeout. |
| 286 """ | 286 """ |
| 287 if self.IsUserBuild(): | 287 if self.IsUserBuild(): |
| 288 raise device_errors.CommandFailedError( | 288 raise device_errors.CommandFailedError( |
| 289 'Cannot enable root in user builds.', str(self)) | 289 'Cannot enable root in user builds.', str(self)) |
| 290 if 'needs_su' in self._cache: | 290 if 'needs_su' in self._cache: |
| 291 del self._cache['needs_su'] | 291 del self._cache['needs_su'] |
| 292 self.adb.Root() | 292 self.adb.Root() |
| 293 self.adb.WaitForDevice() | 293 self.WaitUntilFullyBooted() |
| 294 | 294 |
| 295 @decorators.WithTimeoutAndRetriesFromInstance() | 295 @decorators.WithTimeoutAndRetriesFromInstance() |
| 296 def IsUserBuild(self, timeout=None, retries=None): | 296 def IsUserBuild(self, timeout=None, retries=None): |
| 297 """Checks whether or not the device is running a user build. | 297 """Checks whether or not the device is running a user build. |
| 298 | 298 |
| 299 Args: | 299 Args: |
| 300 timeout: timeout in seconds | 300 timeout: timeout in seconds |
| 301 retries: number of retries | 301 retries: number of retries |
| 302 | 302 |
| 303 Returns: | 303 Returns: |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 blacklist = device_blacklist.ReadBlacklist() | 1579 blacklist = device_blacklist.ReadBlacklist() |
| 1580 def blacklisted(adb): | 1580 def blacklisted(adb): |
| 1581 if adb.GetDeviceSerial() in blacklist: | 1581 if adb.GetDeviceSerial() in blacklist: |
| 1582 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) | 1582 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) |
| 1583 return True | 1583 return True |
| 1584 return False | 1584 return False |
| 1585 | 1585 |
| 1586 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() | 1586 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() |
| 1587 if not blacklisted(adb)] | 1587 if not blacklisted(adb)] |
| 1588 | 1588 |
| OLD | NEW |