diff options
author | craigdh@chromium.org <craigdh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 20:25:50 +0000 |
---|---|---|
committer | craigdh@chromium.org <craigdh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 20:25:50 +0000 |
commit | faea81088977b7eb6446c18023694696aeba8819 (patch) | |
tree | a5a59f6b3b0d1950b8a9dcc84dbee2f0371f6929 /build | |
parent | d20cc57384f01af82e278b5a4fcc24819a6a1a66 (diff) | |
download | chromium_src-faea81088977b7eb6446c18023694696aeba8819.zip chromium_src-faea81088977b7eb6446c18023694696aeba8819.tar.gz chromium_src-faea81088977b7eb6446c18023694696aeba8819.tar.bz2 |
[android] FlagChanger should only require root to set flags for Chrome.
BUG=304832
TEST=None
NOTRY=True
Review URL: https://codereview.chromium.org/26364002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-x | build/android/provision_devices.py | 2 | ||||
-rw-r--r-- | build/android/pylib/constants.py | 8 | ||||
-rw-r--r-- | build/android/pylib/flag_changer.py | 21 | ||||
-rwxr-xr-x | build/android/tombstones.py | 2 |
4 files changed, 26 insertions, 7 deletions
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py index 1d4e521..a392246 100755 --- a/build/android/provision_devices.py +++ b/build/android/provision_devices.py @@ -72,7 +72,7 @@ def ProvisionDevices(options): devices = android_commands.GetAttachedDevices() for device in devices: android_cmd = android_commands.AndroidCommands(device) - android_cmd.RunShellCommand('su -c date -u %f' % time.time()) + android_cmd.RunShellCommandWithSU('date -u %f' % time.time()) if options.auto_reconnect: PushAndLaunchAdbReboot(devices, options.target) diff --git a/build/android/pylib/constants.py b/build/android/pylib/constants.py index b476d8f..2eeb3a3 100644 --- a/build/android/pylib/constants.py +++ b/build/android/pylib/constants.py @@ -58,13 +58,19 @@ PACKAGE_INFO = { 'org.chromium.content_shell_apk.ContentShellActivity', '/data/local/tmp/content-shell-command-line', None, - None), + 'org.chromium.content_shell_apk.tests'), 'chromium_test_shell': PackageInfo( 'org.chromium.chrome.testshell', 'org.chromium.chrome.testshell.ChromiumTestShellActivity', '/data/local/tmp/chromium-testshell-command-line', 'chromium_testshell_devtools_remote', 'org.chromium.chrome.testshell.tests'), + 'android_webview_shell': PackageInfo( + 'org.chromium.android_webview.shell', + 'org.chromium.android_webview.shell.AwShellActivity', + None, + None, + 'org.chromium.android_webview.test'), 'gtest': PackageInfo( 'org.chromium.native_test', 'org.chromium.native_test.ChromeNativeTestActivity', diff --git a/build/android/pylib/flag_changer.py b/build/android/pylib/flag_changer.py index 6c4883a..7e5d091 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) + 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. diff --git a/build/android/tombstones.py b/build/android/tombstones.py index b85a82b..5cbca85 100755 --- a/build/android/tombstones.py +++ b/build/android/tombstones.py @@ -70,7 +70,7 @@ def _EraseTombstone(adb, tombstone_file): Args: tombstone_file: the tombstone to delete. """ - return adb.RunShellCommand('su -c rm /data/tombstones/' + tombstone_file) + return adb.RunShellCommandWithSU('rm /data/tombstones/' + tombstone_file) def _ResolveSymbols(tombstone_data, include_stack): |