Chromium Code Reviews| Index: build/android/pylib/flag_changer.py | 
| diff --git a/build/android/pylib/flag_changer.py b/build/android/pylib/flag_changer.py | 
| index 6c4883a76dc3a97fb5b9991b6cbf8b793e51f654..7e5d091166e25de2160be30bc526c9cfe58dd5d1 100644 | 
| --- a/build/android/pylib/flag_changer.py | 
| +++ b/build/android/pylib/flag_changer.py | 
| @@ -92,14 +92,27 @@ class FlagChanger(object): | 
| def _UpdateCommandLineFile(self): | 
| """Writes out the command line to the file, or removes it if empty.""" | 
| logging.info('Current flags: %s', self._current_flags) | 
| - | 
| + # Root is not required to write to /data/local/tmp/. | 
| + use_root = '/data/local/tmp/' not in self._cmdline_file | 
| if self._current_flags: | 
| # The first command line argument doesn't matter as we are not actually | 
| # launching the chrome executable using this command line. | 
| - self._adb.SetProtectedFileContents(self._cmdline_file, | 
| - ' '.join(['_'] + self._current_flags)) | 
| + cmd_line = ' '.join(['_'] + self._current_flags) | 
| + if use_root: | 
| + self._adb.SetProtectedFileContents(self._cmdline_file, cmd_line) | 
| 
 
frankf
2013/10/08 23:44:52
BTW, why do you need this every time? Can't you ju
 
craigdh
2013/10/08 23:53:30
Let's look at cleaning up all of the *Protected/*S
 
 | 
| + file_contents = self._adb.GetProtectedFileContents(self._cmdline_file) | 
| + else: | 
| + self._adb.SetFileContents(self._cmdline_file, cmd_line) | 
| + file_contents = self._adb.GetFileContents(self._cmdline_file) | 
| + assert len(file_contents) == 1 and file_contents[0] == cmd_line, ( | 
| + 'Failed to set the command line file at %s' % self._cmdline_file) | 
| else: | 
| - self._adb.RunShellCommand('su -c rm ' + self._cmdline_file) | 
| + if use_root: | 
| + self._adb.RunShellCommandWithSU('rm ' + self._cmdline_file) | 
| + else: | 
| + self._adb.RunShellCommand('rm ' + self._cmdline_file) | 
| + assert not self._adb.FileExistsOnDevice(self._cmdline_file), ( | 
| + 'Failed to remove the command line file at %s' % self._cmdline_file) | 
| def _TokenizeFlags(self, line): | 
| """Changes the string containing the command line into a list of flags. |