| Index: devil/devil/android/device_utils.py
|
| diff --git a/devil/devil/android/device_utils.py b/devil/devil/android/device_utils.py
|
| index 05f3181b494d2fbcd47e2e48ae7619b7961dc3e2..bd556ba3d69d6df241b155810d53ce84cdae326c 100644
|
| --- a/devil/devil/android/device_utils.py
|
| +++ b/devil/devil/android/device_utils.py
|
| @@ -1367,12 +1367,14 @@ class DeviceUtils(object):
|
| """
|
| return self.PathExists(device_path, timeout=timeout, retries=retries)
|
|
|
| - def PathExists(self, device_paths, timeout=None, retries=None):
|
| + def PathExists(self, device_paths, as_root=False, timeout=None, retries=None):
|
| """Checks whether the given path(s) exists on the device.
|
|
|
| Args:
|
| device_path: A string containing the absolute path to the file on the
|
| device, or an iterable of paths to check.
|
| + as_root: Whether root permissions should be use to check for the existence
|
| + of the given path(s).
|
| timeout: timeout in seconds
|
| retries: number of retries
|
|
|
| @@ -1387,10 +1389,13 @@ class DeviceUtils(object):
|
| if isinstance(paths, basestring):
|
| paths = (paths,)
|
| condition = ' -a '.join('-e %s' % cmd_helper.SingleQuote(p) for p in paths)
|
| - cmd = 'test %s;echo $?' % condition
|
| - result = self.RunShellCommand(cmd, check_return=True, timeout=timeout,
|
| - retries=retries)
|
| - return '0' == result[0]
|
| + cmd = 'test %s' % condition
|
| + try:
|
| + self.RunShellCommand(cmd, as_root=as_root, check_return=True,
|
| + timeout=timeout, retries=retries)
|
| + return True
|
| + except device_errors.CommandFailedError:
|
| + return False
|
|
|
| @decorators.WithTimeoutAndRetriesFromInstance()
|
| def PullFile(self, device_path, host_path, timeout=None, retries=None):
|
|
|