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

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

Issue 26364002: [android] FlagChanger should only require root to set flags for Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bug Created 7 years, 2 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 | « build/android/pylib/constants.py ('k') | build/android/tombstones.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « build/android/pylib/constants.py ('k') | build/android/tombstones.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698