| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """ A simple device interface for build steps. | 5 """ A simple device interface for build steps. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 def Install(self, *args, **kwargs): | 45 def Install(self, *args, **kwargs): |
| 46 return self.device.Install(*args, **kwargs) | 46 return self.device.Install(*args, **kwargs) |
| 47 | 47 |
| 48 def InstallSplitApk(self, *args, **kwargs): | 48 def InstallSplitApk(self, *args, **kwargs): |
| 49 return self.device.InstallSplitApk(*args, **kwargs) | 49 return self.device.InstallSplitApk(*args, **kwargs) |
| 50 | 50 |
| 51 def GetInstallMetadata(self, apk_package): | 51 def GetInstallMetadata(self, apk_package): |
| 52 """Gets the metadata on the device for the apk_package apk.""" | 52 """Gets the metadata on the device for the apk_package apk.""" |
| 53 # Matches lines like: | 53 # Matches lines like: |
| 54 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ | 54 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ |
| 55 # org.chromium.chrome.shell.apk | 55 # org.chromium.chrome.apk |
| 56 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ | 56 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ |
| 57 # org.chromium.chrome.shell-1.apk | 57 # org.chromium.chrome-1.apk |
| 58 apk_matcher = lambda s: re.match('.*%s(-[0-9]*)?.apk$' % apk_package, s) | 58 apk_matcher = lambda s: re.match('.*%s(-[0-9]*)?.apk$' % apk_package, s) |
| 59 matches = filter(apk_matcher, self.install_metadata) | 59 matches = filter(apk_matcher, self.install_metadata) |
| 60 return matches[0] if matches else None | 60 return matches[0] if matches else None |
| 61 | 61 |
| 62 | 62 |
| 63 def GetConfigurationForDevice(device_id): | 63 def GetConfigurationForDevice(device_id): |
| 64 device = device_utils.DeviceUtils(device_id) | 64 device = device_utils.DeviceUtils(device_id) |
| 65 configuration = None | 65 configuration = None |
| 66 has_root = False | 66 has_root = False |
| 67 is_online = device.IsOnline() | 67 is_online = device.IsOnline() |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 assert len(configurations) == 1 | 102 assert len(configurations) == 1 |
| 103 return BuildDevice(configurations[0]) | 103 return BuildDevice(configurations[0]) |
| 104 | 104 |
| 105 | 105 |
| 106 def GetBuildDeviceFromPath(path): | 106 def GetBuildDeviceFromPath(path): |
| 107 configurations = ReadConfigurations(path) | 107 configurations = ReadConfigurations(path) |
| 108 if len(configurations) > 0: | 108 if len(configurations) > 0: |
| 109 return GetBuildDevice(ReadConfigurations(path)) | 109 return GetBuildDevice(ReadConfigurations(path)) |
| 110 return None | 110 return None |
| 111 | 111 |
| OLD | NEW |