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

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

Issue 12218091: Android Telemetry: automates devices running "user" build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index e3b8fa3e50d823a585094ed9074c1d67552b3da2..6cf47079b75bc590ef2ffe883d236f81676cbce5 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -714,6 +714,19 @@ class AndroidCommands(object):
i += 1
return self.GetExternalStorage() + '/' + base_name % i
+ def GetProtectedFileContents(self, filename, log_result=False):
+ """Gets contents from the protected file specified by |filename|.
+
+ This is less efficient than GetFileContents, but will work for protected
+ files and device files.
+ """
+ temp_script = self._GetDeviceTempFileName(
+ AndroidCommands._TEMP_SCRIPT_FILE_BASE_FMT)
+ self.SetFileContents(temp_script,
+ 'if [ -f "' + filename + '" ]; then cat "' + filename + '"; fi')
+ # Run the script as root
+ return self.RunShellCommand('su -c sh %s' % temp_script)
Sami 2013/02/11 14:57:13 Any reason why we can't just do 'su -c cat "%s" 2>
bulach 2013/02/11 18:47:25 great idea, looks better... :) fixed GetFileConten
+
def SetProtectedFileContents(self, filename, contents):
"""Writes |contents| to the protected file specified by |filename|.

Powered by Google App Engine
This is Rietveld 408576698