| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import pipes | 6 import pipes |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 from pylib.device import device_errors # pylint: disable=F0401 | 9 from devil.android import device_errors # pylint: disable=F0401 |
| 10 | 10 |
| 11 | 11 |
| 12 def _QuoteIfNeeded(arg): | 12 def _QuoteIfNeeded(arg): |
| 13 # Properly escape "key=valueA valueB" to "key='valueA valueB'" | 13 # Properly escape "key=valueA valueB" to "key='valueA valueB'" |
| 14 # Values without spaces, or that seem to be quoted are left untouched. | 14 # Values without spaces, or that seem to be quoted are left untouched. |
| 15 # This is required so CommandLine.java can parse valueB correctly rather | 15 # This is required so CommandLine.java can parse valueB correctly rather |
| 16 # than as a separate switch. | 16 # than as a separate switch. |
| 17 params = arg.split('=', 1) | 17 params = arg.split('=', 1) |
| 18 if len(params) != 2: | 18 if len(params) != 2: |
| 19 return arg | 19 return arg |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 def _ReadFile(self): | 99 def _ReadFile(self): |
| 100 return self._device.ReadFile(self.command_line_file, as_root=True) | 100 return self._device.ReadFile(self.command_line_file, as_root=True) |
| 101 | 101 |
| 102 def _WriteFile(self, contents): | 102 def _WriteFile(self, contents): |
| 103 self._device.WriteFile(self.command_line_file, contents, as_root=True) | 103 self._device.WriteFile(self.command_line_file, contents, as_root=True) |
| 104 | 104 |
| 105 def _RemoveFile(self): | 105 def _RemoveFile(self): |
| 106 self._device.RunShellCommand(['rm', '-f', self.command_line_file], | 106 self._device.RunShellCommand(['rm', '-f', self.command_line_file], |
| 107 as_root=True, check_return=True) | 107 as_root=True, check_return=True) |
| OLD | NEW |