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

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

Issue 10809017: Android: Fix one issue for instrumentation on "user" devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months 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 | build/android/pylib/run_java_tests.py » ('j') | 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 device: If given, adb commands are only send to the device of this ID. 212 device: If given, adb commands are only send to the device of this ID.
213 Otherwise commands are sent to all attached devices. 213 Otherwise commands are sent to all attached devices.
214 """ 214 """
215 215
216 def __init__(self, device=None): 216 def __init__(self, device=None):
217 self._adb = adb_interface.AdbInterface() 217 self._adb = adb_interface.AdbInterface()
218 if device: 218 if device:
219 self._adb.SetTargetSerial(device) 219 self._adb.SetTargetSerial(device)
220 # So many users require root that we just always do it. This could 220 # So many users require root that we just always do it. This could
221 # be made more fine grain if necessary. 221 # be made more fine grain if necessary.
222 self._adb.EnableAdbRoot() 222 self._root_enabled = self._adb.EnableAdbRoot()
223 self._logcat = None 223 self._logcat = None
224 self._original_governor = None 224 self._original_governor = None
225 self._pushed_files = [] 225 self._pushed_files = []
226 self._device_utc_offset = self.RunShellCommand('date +%z')[0] 226 self._device_utc_offset = self.RunShellCommand('date +%z')[0]
227 227
228 def Adb(self): 228 def Adb(self):
229 """Returns our AdbInterface to avoid us wrapping all its methods.""" 229 """Returns our AdbInterface to avoid us wrapping all its methods."""
230 return self._adb 230 return self._adb
231 231
232 def IsRootEnabled(self):
233 """Returns whether or not _adb.EnabledAdbRoot() has succeeded."""
234 return self._root_enabled
235
232 def GetDeviceYear(self): 236 def GetDeviceYear(self):
233 """Returns the year information of the date on device""" 237 """Returns the year information of the date on device"""
234 return self.RunShellCommand('date +%Y')[0] 238 return self.RunShellCommand('date +%Y')[0]
235 239
236 def WaitForDevicePm(self): 240 def WaitForDevicePm(self):
237 """Blocks until the device's package manager is available. 241 """Blocks until the device's package manager is available.
238 242
239 To workaround http://b/5201039, we restart the shell and retry if the 243 To workaround http://b/5201039, we restart the shell and retry if the
240 package manager isn't back after 120 seconds. 244 package manager isn't back after 120 seconds.
241 245
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if len(process_results) <= 8: 938 if len(process_results) <= 8:
935 continue 939 continue
936 # Column 0 is the executable name 940 # Column 0 is the executable name
937 # Column 1 is the pid 941 # Column 1 is the pid
938 # Column 8 is the Inode in use 942 # Column 8 is the Inode in use
939 if process_results[8] == socket_name: 943 if process_results[8] == socket_name:
940 pids.append( (int(process_results[1]), process_results[0]) ) 944 pids.append( (int(process_results[1]), process_results[0]) )
941 break 945 break
942 logging.info('PidsUsingDevicePort: %s', pids) 946 logging.info('PidsUsingDevicePort: %s', pids)
943 return pids 947 return pids
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/run_java_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698