Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Unified Diff: build/android/devil/android/device_utils.py

Issue 1335673004: [Android] grant READ_EXTERNAL_STORAGE permission when adding WRITE_EXTERNAL_STORAGE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/devil/android/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/devil/android/device_utils.py
diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py
index 5be914cdbdaae803747c576581a672ff53416aed..951bae44f7da32e0639993e51de8499054c415bd 100644
--- a/build/android/devil/android/device_utils.py
+++ b/build/android/devil/android/device_utils.py
@@ -565,7 +565,6 @@ class DeviceUtils(object):
permissions = apk_helper.ApkHelper(apk_path).GetPermissions()
self.GrantPermissions(package_name, permissions)
-
@decorators.WithTimeoutAndRetriesDefaults(
INSTALL_DEFAULT_TIMEOUT,
INSTALL_DEFAULT_RETRIES)
@@ -1963,11 +1962,12 @@ class DeviceUtils(object):
# TODO(rnephew): After permission blacklist is complete, switch to using
# &&s instead of ;s.
cmd = ''
- logging.info('Setting permissions for %s', package)
- for p in permissions:
- if p not in _PERMISSIONS_BLACKLIST:
- cmd += 'pm grant %s %s;' % (package, p)
- logging.info(' %s', p)
+ logging.info('Setting permissions for %s.', package)
+ permissions = [p for p in permissions if p not in _PERMISSIONS_BLACKLIST]
+ if ('android.permission.WRITE_EXTERNAL_STORAGE' in permissions
+ and 'android.permission.READ_EXTERNAL_STORAGE' not in permissions):
+ permissions.append('android.permission.READ_EXTERNAL_STORAGE')
+ cmd = ';'.join('pm grant %s %s' %(package, p) for p in permissions)
if cmd:
output = self.RunShellCommand(cmd)
if output:
« no previous file with comments | « no previous file | build/android/devil/android/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698