| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
| 6 | 6 |
| 7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import collections | 10 import collections |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if self._device: | 255 if self._device: |
| 256 device_repr = self._device[-4:] | 256 device_repr = self._device[-4:] |
| 257 else: | 257 else: |
| 258 device_repr = '????' | 258 device_repr = '????' |
| 259 logging.info('[%s]> %s', device_repr, cmd) | 259 logging.info('[%s]> %s', device_repr, cmd) |
| 260 | 260 |
| 261 def Adb(self): | 261 def Adb(self): |
| 262 """Returns our AdbInterface to avoid us wrapping all its methods.""" | 262 """Returns our AdbInterface to avoid us wrapping all its methods.""" |
| 263 return self._adb | 263 return self._adb |
| 264 | 264 |
| 265 def GetDevice(self): |
| 266 """Returns the device serial.""" |
| 267 return self._device |
| 268 |
| 265 def IsOnline(self): | 269 def IsOnline(self): |
| 266 """Checks whether the device is online. | 270 """Checks whether the device is online. |
| 267 | 271 |
| 268 Returns: | 272 Returns: |
| 269 True if device is in 'device' mode, False otherwise. | 273 True if device is in 'device' mode, False otherwise. |
| 270 """ | 274 """ |
| 271 out = self._adb.SendCommand('get-state') | 275 out = self._adb.SendCommand('get-state') |
| 272 return out.strip() == 'device' | 276 return out.strip() == 'device' |
| 273 | 277 |
| 274 def IsRootEnabled(self): | 278 def IsRootEnabled(self): |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 """ | 1472 """ |
| 1469 def __init__(self, output): | 1473 def __init__(self, output): |
| 1470 self._output = output | 1474 self._output = output |
| 1471 | 1475 |
| 1472 def write(self, data): | 1476 def write(self, data): |
| 1473 data = data.replace('\r\r\n', '\n') | 1477 data = data.replace('\r\r\n', '\n') |
| 1474 self._output.write(data) | 1478 self._output.write(data) |
| 1475 | 1479 |
| 1476 def flush(self): | 1480 def flush(self): |
| 1477 self._output.flush() | 1481 self._output.flush() |
| OLD | NEW |