Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: build/android/pylib/android_commands.py

Issue 91563002: Android: makes "RestartAdbdOnDevice" more robust. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 reboots_left -= 1 458 reboots_left -= 1
459 459
460 def MakeSystemFolderWritable(self): 460 def MakeSystemFolderWritable(self):
461 """Remounts the /system folder rw.""" 461 """Remounts the /system folder rw."""
462 out = self._adb.SendCommand('remount') 462 out = self._adb.SendCommand('remount')
463 if out.strip() != 'remount succeeded': 463 if out.strip() != 'remount succeeded':
464 raise errors.MsgException('Remount failed: %s' % out) 464 raise errors.MsgException('Remount failed: %s' % out)
465 465
466 def RestartAdbdOnDevice(self): 466 def RestartAdbdOnDevice(self):
467 logging.info('Killing adbd on the device...') 467 logging.info('Killing adbd on the device...')
468 adb_pids = self.KillAll('adbd', signal=signal.SIGTERM, with_su=True) 468 try:
469 assert adb_pids, 'Unable to obtain adbd pid' 469 if not self.KillAll('adbd', signal=signal.SIGTERM, with_su=True):
470 logging.info('Waiting for device to settle...') 470 logging.error('Unable to obtain adbd pid')
471 self._adb.SendCommand('wait-for-device') 471 logging.info('Waiting for device to settle...')
472 self._adb.SendCommand('wait-for-device')
tonyg 2013/11/27 16:24:15 The idea of this wait-for-device is that it must b
bulach 2013/11/27 18:04:27 you're right. I was mistaken, KillAll just returns
473 except Except as e:
tonyg 2013/11/27 16:24:15 s/Except/Exception/ -- no?
bulach 2013/11/27 18:04:27 facepalm :(
474 logging.error('Exception when trying to kill adbd on the device [%s]', e)
472 475
473 def RestartAdbServer(self): 476 def RestartAdbServer(self):
474 """Restart the adb server.""" 477 """Restart the adb server."""
475 ret = self.KillAdbServer() 478 ret = self.KillAdbServer()
476 if ret != 0: 479 if ret != 0:
477 raise errors.MsgException('KillAdbServer: %d' % ret) 480 raise errors.MsgException('KillAdbServer: %d' % ret)
478 481
479 ret = self.StartAdbServer() 482 ret = self.StartAdbServer()
480 if ret != 0: 483 if ret != 0:
481 raise errors.MsgException('StartAdbServer: %d' % ret) 484 raise errors.MsgException('StartAdbServer: %d' % ret)
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 """ 1706 """
1704 def __init__(self, output): 1707 def __init__(self, output):
1705 self._output = output 1708 self._output = output
1706 1709
1707 def write(self, data): 1710 def write(self, data):
1708 data = data.replace('\r\r\n', '\n') 1711 data = data.replace('\r\r\n', '\n')
1709 self._output.write(data) 1712 self._output.write(data)
1710 1713
1711 def flush(self): 1714 def flush(self):
1712 self._output.flush() 1715 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698