Chromium Code Reviews| 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|. |