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

Side by Side Diff: build/android/pylib/device/device_utils.py

Issue 772003002: Migrate DeviceUtils.EnableRoot to adb_wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 a variety of device interactions based on adb. 5 """Provides a variety of device interactions based on adb.
6 6
7 Eventually, this will be based on adb_wrapper. 7 Eventually, this will be based on adb_wrapper.
8 """ 8 """
9 # pylint: disable=W0613 9 # pylint: disable=W0613
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 """Restarts adbd with root privileges. 170 """Restarts adbd with root privileges.
171 171
172 Args: 172 Args:
173 timeout: timeout in seconds 173 timeout: timeout in seconds
174 retries: number of retries 174 retries: number of retries
175 175
176 Raises: 176 Raises:
177 CommandFailedError if root could not be enabled. 177 CommandFailedError if root could not be enabled.
178 CommandTimeoutError on timeout. 178 CommandTimeoutError on timeout.
179 """ 179 """
180 if self.IsUserBuild():
181 raise device_errors.CommandFailedError(
182 'Cannot enable root in user builds.', str(self))
180 if 'needs_su' in self._cache: 183 if 'needs_su' in self._cache:
181 del self._cache['needs_su'] 184 del self._cache['needs_su']
182 if not self.old_interface.EnableAdbRoot(): 185 self.adb.Root()
183 raise device_errors.CommandFailedError( 186 self.adb.WaitForDevice()
184 'Could not enable root.', str(self))
185 187
186 @decorators.WithTimeoutAndRetriesFromInstance() 188 @decorators.WithTimeoutAndRetriesFromInstance()
187 def IsUserBuild(self, timeout=None, retries=None): 189 def IsUserBuild(self, timeout=None, retries=None):
188 """Checks whether or not the device is running a user build. 190 """Checks whether or not the device is running a user build.
189 191
190 Args: 192 Args:
191 timeout: timeout in seconds 193 timeout: timeout in seconds
192 retries: number of retries 194 retries: number of retries
193 195
194 Returns: 196 Returns:
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 Returns: 1169 Returns:
1168 A Parallelizer operating over |devices|. 1170 A Parallelizer operating over |devices|.
1169 """ 1171 """
1170 if not devices or len(devices) == 0: 1172 if not devices or len(devices) == 0:
1171 devices = pylib.android_commands.GetAttachedDevices() 1173 devices = pylib.android_commands.GetAttachedDevices()
1172 parallelizer_type = (parallelizer.Parallelizer if async 1174 parallelizer_type = (parallelizer.Parallelizer if async
1173 else parallelizer.SyncParallelizer) 1175 else parallelizer.SyncParallelizer)
1174 return parallelizer_type([ 1176 return parallelizer_type([
1175 d if isinstance(d, DeviceUtils) else DeviceUtils(d) 1177 d if isinstance(d, DeviceUtils) else DeviceUtils(d)
1176 for d in devices]) 1178 for d in devices])
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698