| Index: build/android/pylib/android_commands.py
|
| diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
|
| index 4228b035f134187443d9fff1d89363d635677b33..76d8ca3fea010304a4a8ff9da859ae0f1592b11a 100644
|
| --- a/build/android/pylib/android_commands.py
|
| +++ b/build/android/pylib/android_commands.py
|
| @@ -1473,6 +1473,29 @@ class AndroidCommands(object):
|
|
|
| return False
|
|
|
| + def IsFileWritableOnDevice(self, file_name):
|
| + """Checks whether the given file (or directory) is writable on the device.
|
| +
|
| + Args:
|
| + file_name: Full path of file/directory to check.
|
| +
|
| + Returns:
|
| + True if writable, False otherwise.
|
| + """
|
| + assert '"' not in file_name, 'file_name cannot contain double quotes'
|
| + try:
|
| + status = self._adb.SendShellCommand(
|
| + '\'test -w "%s"; echo $?\'' % (file_name))
|
| + if 'test: not found' not in status:
|
| + return int(status) == 0
|
| + raise errors.AbortError('"test" binary not found. OS too old.')
|
| +
|
| + except ValueError:
|
| + if IsDeviceAttached(self._device):
|
| + raise errors.DeviceUnresponsiveError('Device may be offline.')
|
| +
|
| + return False
|
| +
|
| def TakeScreenshot(self, host_file):
|
| """Saves a screenshot image to |host_file| on the host.
|
|
|
|
|