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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 | 1367 |
1368 @property | 1368 @property |
1369 def screen_density(self): | 1369 def screen_density(self): |
1370 """Returns the screen density of the device.""" | 1370 """Returns the screen density of the device.""" |
1371 DPI_TO_DENSITY = { | 1371 DPI_TO_DENSITY = { |
1372 120: 'ldpi', | 1372 120: 'ldpi', |
1373 160: 'mdpi', | 1373 160: 'mdpi', |
1374 240: 'hdpi', | 1374 240: 'hdpi', |
1375 320: 'xhdpi', | 1375 320: 'xhdpi', |
1376 480: 'xxhdpi', | 1376 480: 'xxhdpi', |
| 1377 640: 'xxxhdpi', |
1377 } | 1378 } |
1378 dpi = int(self.GetProp('ro.sf.lcd_density', cache=True)) | 1379 dpi = int(self.GetProp('ro.sf.lcd_density', cache=True)) |
1379 return DPI_TO_DENSITY.get(dpi, 'tvdpi') | 1380 return DPI_TO_DENSITY.get(dpi, 'tvdpi') |
1380 | 1381 |
1381 @property | 1382 @property |
1382 def build_description(self): | 1383 def build_description(self): |
1383 """Returns the build description of the system. | 1384 """Returns the build description of the system. |
1384 | 1385 |
1385 For example: | 1386 For example: |
1386 nakasi-user 4.4.4 KTU84P 1227136 release-keys | 1387 nakasi-user 4.4.4 KTU84P 1227136 release-keys |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 @classmethod | 1711 @classmethod |
1711 def HealthyDevices(cls): | 1712 def HealthyDevices(cls): |
1712 blacklist = device_blacklist.ReadBlacklist() | 1713 blacklist = device_blacklist.ReadBlacklist() |
1713 def blacklisted(adb): | 1714 def blacklisted(adb): |
1714 if adb.GetDeviceSerial() in blacklist: | 1715 if adb.GetDeviceSerial() in blacklist: |
1715 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) | 1716 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) |
1716 return True | 1717 return True |
1717 return False | 1718 return False |
1718 | 1719 |
1719 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() | 1720 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() |
1720 if not blacklisted(adb)] | 1721 if not blacklisted(adb)] |
OLD | NEW |