| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 | 6 |
| 7 import pylib.android_commands | 7 import pylib.android_commands |
| 8 import pylib.device.device_utils | 8 import pylib.device.device_utils |
| 9 | 9 |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 self._cmdline_file, cmd_line) | 107 self._cmdline_file, cmd_line) |
| 108 file_contents = self._device.old_interface.GetProtectedFileContents( | 108 file_contents = self._device.old_interface.GetProtectedFileContents( |
| 109 self._cmdline_file) | 109 self._cmdline_file) |
| 110 else: | 110 else: |
| 111 self._device.old_interface.SetFileContents(self._cmdline_file, cmd_line) | 111 self._device.old_interface.SetFileContents(self._cmdline_file, cmd_line) |
| 112 file_contents = self._device.old_interface.GetFileContents( | 112 file_contents = self._device.old_interface.GetFileContents( |
| 113 self._cmdline_file) | 113 self._cmdline_file) |
| 114 assert len(file_contents) == 1 and file_contents[0] == cmd_line, ( | 114 assert len(file_contents) == 1 and file_contents[0] == cmd_line, ( |
| 115 'Failed to set the command line file at %s' % self._cmdline_file) | 115 'Failed to set the command line file at %s' % self._cmdline_file) |
| 116 else: | 116 else: |
| 117 if use_root: | 117 self._device.RunShellCommand('rm ' + self._cmdline_file, root=use_root) |
| 118 self._device.old_interface.RunShellCommandWithSU( | |
| 119 'rm ' + self._cmdline_file) | |
| 120 else: | |
| 121 self._device.old_interface.RunShellCommand('rm ' + self._cmdline_file) | |
| 122 assert ( | 118 assert ( |
| 123 not self._device.old_interface.FileExistsOnDevice( | 119 not self._device.old_interface.FileExistsOnDevice( |
| 124 self._cmdline_file)), ( | 120 self._cmdline_file)), ( |
| 125 'Failed to remove the command line file at %s' % self._cmdline_file) | 121 'Failed to remove the command line file at %s' % self._cmdline_file) |
| 126 | 122 |
| 127 @staticmethod | 123 @staticmethod |
| 128 def _TokenizeFlags(line): | 124 def _TokenizeFlags(line): |
| 129 """Changes the string containing the command line into a list of flags. | 125 """Changes the string containing the command line into a list of flags. |
| 130 | 126 |
| 131 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: | 127 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 161 |
| 166 # Tack on the last flag. | 162 # Tack on the last flag. |
| 167 if not current_flag: | 163 if not current_flag: |
| 168 if within_quotations: | 164 if within_quotations: |
| 169 logging.warn('Unterminated quoted argument: ' + line) | 165 logging.warn('Unterminated quoted argument: ' + line) |
| 170 else: | 166 else: |
| 171 tokenized_flags.append(current_flag) | 167 tokenized_flags.append(current_flag) |
| 172 | 168 |
| 173 # Return everything but the program name. | 169 # Return everything but the program name. |
| 174 return tokenized_flags[1:] | 170 return tokenized_flags[1:] |
| OLD | NEW |