Chromium Code Reviews| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 # Force a hard reboot on last attempt | 451 # Force a hard reboot on last attempt |
| 452 self.Reboot(full_reboot=(reboots_left == 1)) | 452 self.Reboot(full_reboot=(reboots_left == 1)) |
| 453 reboots_left -= 1 | 453 reboots_left -= 1 |
| 454 | 454 |
| 455 def MakeSystemFolderWritable(self): | 455 def MakeSystemFolderWritable(self): |
| 456 """Remounts the /system folder rw.""" | 456 """Remounts the /system folder rw.""" |
| 457 out = self._adb.SendCommand('remount') | 457 out = self._adb.SendCommand('remount') |
| 458 if out.strip() != 'remount succeeded': | 458 if out.strip() != 'remount succeeded': |
| 459 raise errors.MsgException('Remount failed: %s' % out) | 459 raise errors.MsgException('Remount failed: %s' % out) |
| 460 | 460 |
| 461 def KillAdbdDevice(self): | |
|
rmcilroy
2013/10/21 11:33:13
Nit - how about RestartAdbdOnDevice()?
bulach
2013/10/21 15:30:13
Done.
| |
| 462 logging.info('Killing adbd on the device...') | |
| 463 adb_pids = self.ExtractPid('adbd') | |
| 464 if adb_pids: | |
| 465 self.RunShellCommandWithSU('kill %s' % ' '.join(adb_pids)) | |
| 466 logging.info('Waiting for device to settle...') | |
|
rmcilroy
2013/10/21 11:33:13
Nit - "Waiting for adbd to restart on device..." ?
bulach
2013/10/21 15:30:13
yes! :) thankfully, it's already done at a lower l
| |
| 467 self._adb.SendCommand('wait-for-device') | |
| 468 | |
| 461 def RestartAdbServer(self): | 469 def RestartAdbServer(self): |
| 462 """Restart the adb server.""" | 470 """Restart the adb server.""" |
| 463 ret = self.KillAdbServer() | 471 ret = self.KillAdbServer() |
| 464 if ret != 0: | 472 if ret != 0: |
| 465 raise errors.MsgException('KillAdbServer: %d' % ret) | 473 raise errors.MsgException('KillAdbServer: %d' % ret) |
| 466 | 474 |
| 467 ret = self.StartAdbServer() | 475 ret = self.StartAdbServer() |
| 468 if ret != 0: | 476 if ret != 0: |
| 469 raise errors.MsgException('StartAdbServer: %d' % ret) | 477 raise errors.MsgException('StartAdbServer: %d' % ret) |
| 470 | 478 |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1641 """ | 1649 """ |
| 1642 def __init__(self, output): | 1650 def __init__(self, output): |
| 1643 self._output = output | 1651 self._output = output |
| 1644 | 1652 |
| 1645 def write(self, data): | 1653 def write(self, data): |
| 1646 data = data.replace('\r\r\n', '\n') | 1654 data = data.replace('\r\r\n', '\n') |
| 1647 self._output.write(data) | 1655 self._output.write(data) |
| 1648 | 1656 |
| 1649 def flush(self): | 1657 def flush(self): |
| 1650 self._output.flush() | 1658 self._output.flush() |
| OLD | NEW |