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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 if property_name in self._cache: | 1375 if property_name in self._cache: |
1376 del self._cache[property_name] | 1376 del self._cache[property_name] |
1377 # TODO(perezju) remove the option and make the check mandatory, but using a | 1377 # TODO(perezju) remove the option and make the check mandatory, but using a |
1378 # single shell script to both set- and getprop. | 1378 # single shell script to both set- and getprop. |
1379 if check and value != self.GetProp(property_name): | 1379 if check and value != self.GetProp(property_name): |
1380 raise device_errors.CommandFailedError( | 1380 raise device_errors.CommandFailedError( |
1381 'Unable to set property %r on the device to %r' | 1381 'Unable to set property %r on the device to %r' |
1382 % (property_name, value), str(self)) | 1382 % (property_name, value), str(self)) |
1383 | 1383 |
1384 @decorators.WithTimeoutAndRetriesFromInstance() | 1384 @decorators.WithTimeoutAndRetriesFromInstance() |
| 1385 def GetABI(self, timeout=None, retries=None): |
| 1386 """Gets the device main ABI. |
| 1387 |
| 1388 Args: |
| 1389 timeout: timeout in seconds |
| 1390 retries: number of retries |
| 1391 |
| 1392 Returns: |
| 1393 The device's main ABI name. |
| 1394 |
| 1395 Raises: |
| 1396 CommandTimeoutError on timeout. |
| 1397 """ |
| 1398 return self.GetProp('ro.product.cpu.abi') |
| 1399 |
| 1400 @decorators.WithTimeoutAndRetriesFromInstance() |
1385 def GetPids(self, process_name, timeout=None, retries=None): | 1401 def GetPids(self, process_name, timeout=None, retries=None): |
1386 """Returns the PIDs of processes with the given name. | 1402 """Returns the PIDs of processes with the given name. |
1387 | 1403 |
1388 Note that the |process_name| is often the package name. | 1404 Note that the |process_name| is often the package name. |
1389 | 1405 |
1390 Args: | 1406 Args: |
1391 process_name: A string containing the process name to get the PIDs for. | 1407 process_name: A string containing the process name to get the PIDs for. |
1392 timeout: timeout in seconds | 1408 timeout: timeout in seconds |
1393 retries: number of retries | 1409 retries: number of retries |
1394 | 1410 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 blacklist = device_blacklist.ReadBlacklist() | 1579 blacklist = device_blacklist.ReadBlacklist() |
1564 def blacklisted(adb): | 1580 def blacklisted(adb): |
1565 if adb.GetDeviceSerial() in blacklist: | 1581 if adb.GetDeviceSerial() in blacklist: |
1566 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) | 1582 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) |
1567 return True | 1583 return True |
1568 return False | 1584 return False |
1569 | 1585 |
1570 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() | 1586 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() |
1571 if not blacklisted(adb)] | 1587 if not blacklisted(adb)] |
1572 | 1588 |
OLD | NEW |