diff options
author | Marco Nelissen <marcone@google.com> | 2013-10-09 19:59:48 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-09 19:59:48 -0700 |
commit | c52e76d303c6539179b898c444c844787ba44dd4 (patch) | |
tree | dfaa76f11fe4cabc546a022ea72f0fed84647b31 | |
parent | dd49212acd839cb078d89755d3e57d59ce02cd9e (diff) | |
parent | 81df095d28df9f1609fb9407262e0e1c3f733231 (diff) | |
download | MediaProvider-c52e76d303c6539179b898c444c844787ba44dd4.tar.gz |
am 81df095d: am e9a60faf: am e9052856: am 1cb04c3a: am b75caaed: am 28680dd8: am 39955731: am dc906ab2: Fix access to secondary storage
* commit '81df095d28df9f1609fb9407262e0e1c3f733231':
Fix access to secondary storage
-rwxr-xr-x | src/com/android/providers/media/MediaProvider.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java index 92903125d..3e03ae6cc 100755 --- a/src/com/android/providers/media/MediaProvider.java +++ b/src/com/android/providers/media/MediaProvider.java @@ -4618,11 +4618,24 @@ public class MediaProvider extends ContentProvider { } else if (isWrite) { // don't write to non-cache, non-sdcard files. throw new FileNotFoundException("Can't access " + file); + } else if (isSecondaryExternalPath(path)) { + // read access is OK with the appropriate permission + getContext().enforceCallingOrSelfPermission( + READ_EXTERNAL_STORAGE, "External path: " + path); } else { checkWorldReadAccess(path); } } + private boolean isSecondaryExternalPath(String path) { + for (int i = mExternalStoragePaths.length - 1; i >= 0; --i) { + if (path.startsWith(mExternalStoragePaths[i])) { + return true; + } + } + return false; + } + /** * Check whether the path is a world-readable file */ |