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

Unified Diff: build/android/pylib/android_commands.py

Issue 23681011: Android: splits cache_control and perf_control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More files Created 7 years, 3 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 | build/android/pylib/instrumentation/json_perf_parser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 4f2bf26f4b4629b484f4d6a11f9a97fe30332d13..88f7330d0ae916467bfce14513a8b870e076ebd5 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -937,13 +937,18 @@ class AndroidCommands(object):
i += 1
return self.GetExternalStorage() + '/' + base_name % i
+ def RunShellCommandWithSU(self, command, timeout_time=20, log_result=False):
+ return self.RunShellCommand('su -c %s' % command,
+ timeout_time=timeout_time,
+ log_result=log_result)
+
def CanAccessProtectedFileContents(self):
"""Returns True if Get/SetProtectedFileContents would work via "su".
Devices running user builds don't have adb root, but may provide "su" which
can be used for accessing protected files.
"""
- r = self.RunShellCommand('su -c cat /dev/null')
+ r = self.RunShellCommandWithSU('cat /dev/null')
return r == [] or r[0].strip() == ''
def GetProtectedFileContents(self, filename, log_result=False):
@@ -953,7 +958,7 @@ class AndroidCommands(object):
files and device files.
"""
# Run the script as root
- return self.RunShellCommand('su -c cat "%s" 2> /dev/null' % filename)
+ return self.RunShellCommandWithSU('cat "%s" 2> /dev/null' % filename)
def SetProtectedFileContents(self, filename, contents):
"""Writes |contents| to the protected file specified by |filename|.
@@ -970,7 +975,7 @@ class AndroidCommands(object):
# Create a script to copy the file contents to its final destination
self.SetFileContents(temp_script, 'cat %s > %s' % (temp_file, filename))
# Run the script as root
- self.RunShellCommand('su -c sh %s' % temp_script)
+ self.RunShellCommandWithSU('sh %s' % temp_script)
# And remove the temporary files
self.RunShellCommand('rm ' + temp_file)
self.RunShellCommand('rm ' + temp_script)
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/json_perf_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698