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

Unified Diff: devil/devil/android/device_utils.py

Issue 2814993004: [devil] If possible, allow to enable root on user builds. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | devil/devil/android/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/device_utils.py
diff --git a/devil/devil/android/device_utils.py b/devil/devil/android/device_utils.py
index 50f362c3839974e7d296ff08c6cc7669b63b3a85..741ce640143b464d65a22b58b782a5f7a85e44ec 100644
--- a/devil/devil/android/device_utils.py
+++ b/devil/devil/android/device_utils.py
@@ -444,12 +444,18 @@ class DeviceUtils(object):
CommandFailedError if root could not be enabled.
CommandTimeoutError on timeout.
"""
- if self.IsUserBuild():
- raise device_errors.CommandFailedError(
- 'Cannot enable root in user builds.', str(self))
if 'needs_su' in self._cache:
del self._cache['needs_su']
- self.adb.Root()
+
+ try:
+ self.adb.Root()
+ except device_errors.AdbCommandFailedError:
+ if self.IsUserBuild():
+ raise device_errors.CommandFailedError(
+ 'Unable to root device with user build.', str(self))
+ else:
+ raise # Failed probably due to some other reason.
+
self.WaitUntilFullyBooted()
@decorators.WithTimeoutAndRetriesFromInstance()
« no previous file with comments | « no previous file | devil/devil/android/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698