Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index fcf97a859ed139a3bbeb91c71d7ae0ab7387b0c3..96ea7230059aafe746a762c67eb60904e38a6116 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -150,7 +150,7 @@ def _GetFilesFromRecursiveLsOutput(path, ls_output, re_file, utc_offset=None): |
if file_match: |
filename = os.path.join(current_dir, file_match.group('filename')) |
if filename.startswith(path_dir): |
- filename = filename[len(path_dir)+1:] |
+ filename = filename[len(path_dir) + 1:] |
lastmod = datetime.datetime.strptime( |
file_match.group('date') + ' ' + file_match.group('time')[:5], |
'%Y-%m-%d %H:%M') |
@@ -226,12 +226,16 @@ class AndroidCommands(object): |
True: if output from executing adb root was as expected. |
False: otherwise. |
""" |
- return_value = self._adb.EnableAdbRoot() |
- # EnableAdbRoot inserts a call for wait-for-device only when adb logcat |
- # output matches what is expected. Just to be safe add a call to |
- # wait-for-device. |
- self._adb.SendCommand('wait-for-device') |
- return return_value |
+ if self.GetBuildType() == 'user': |
+ logging.warning("Can't enable root in production builds with type user") |
+ return False |
+ else: |
+ return_value = self._adb.EnableAdbRoot() |
+ # EnableAdbRoot inserts a call for wait-for-device only when adb logcat |
+ # output matches what is expected. Just to be safe add a call to |
+ # wait-for-device. |
+ self._adb.SendCommand('wait-for-device') |
+ return return_value |
def GetDeviceYear(self): |
"""Returns the year information of the date on device.""" |
@@ -328,7 +332,9 @@ class AndroidCommands(object): |
install_cmd = ' '.join(install_cmd) |
logging.info('>>> $' + install_cmd) |
- return self._adb.SendCommand(install_cmd, timeout_time=2*60, retry_count=0) |
+ return self._adb.SendCommand(install_cmd, |
+ timeout_time=2 * 60, |
+ retry_count=0) |
def ManagedInstall(self, apk_path, keep_data=False, package_name=None, |
reboots_on_failure=2): |
@@ -636,14 +642,14 @@ class AndroidCommands(object): |
# They don't match, so remove everything first and then create it. |
if os.path.isdir(local_path): |
- self.RunShellCommand('rm -r %s' % device_path, timeout_time=2*60) |
+ self.RunShellCommand('rm -r %s' % device_path, timeout_time=2 * 60) |
self.RunShellCommand('mkdir -p %s' % device_path) |
# NOTE: We can't use adb_interface.Push() because it hardcodes a timeout of |
# 60 seconds which isn't sufficient for a lot of users of this method. |
push_command = 'push %s %s' % (local_path, device_path) |
logging.info('>>> $' + push_command) |
- output = self._adb.SendCommand(push_command, timeout_time=30*60) |
+ output = self._adb.SendCommand(push_command, timeout_time=30 * 60) |
assert _HasAdbPushSucceeded(output) |
@@ -662,7 +668,7 @@ class AndroidCommands(object): |
def RemovePushedFiles(self): |
"""Removes all files pushed with PushIfNeeded() from the device.""" |
for p in self._pushed_files: |
- self.RunShellCommand('rm -r %s' % p, timeout_time=2*60) |
+ self.RunShellCommand('rm -r %s' % p, timeout_time=2 * 60) |
def ListPathContents(self, path): |
"""Lists files in all subdirectories of |path|. |