From 15471944181f34184e6c6eaf6175ed115919545c Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 16 Sep 2016 12:04:05 -0600 Subject: Use "all_downloads" instead of "my_downloads". We can no longer return the "my_downloads" paths: if those Uris were shared beyond the app that requested the download, access would be denied. Instead, we need to switch to using "all_downloads" Uris so that permission grants can be issued to third-party viewer apps. Since an app requesting a download doesn't normally have permission to "all_downloads" paths, DownloadProvider now issues narrow grants toward the owner of each download, both at device boot and when new downloads are started. Bug: 30537115, 30945409 Change-Id: I533125b36444877f54373d88922f2acc777e250b --- core/java/android/app/DownloadManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 2ed8b0fbe24c..1e15a3ac4100 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -1045,7 +1045,7 @@ public class DownloadManager { destination == Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING || destination == Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE) { // return private uri - return ContentUris.withAppendedId(Downloads.Impl.CONTENT_URI, id); + return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, id); } else { // return public uri String path = cursor.getString( @@ -1248,7 +1248,7 @@ public class DownloadManager { * @hide */ public Uri getDownloadUri(long id) { - return ContentUris.withAppendedId(mBaseUri, id); + return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, id); } /** @@ -1329,7 +1329,7 @@ public class DownloadManager { // return content URI for cache download long downloadId = getLong(getColumnIndex(Downloads.Impl._ID)); - return ContentUris.withAppendedId(mBaseUri, downloadId).toString(); + return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, downloadId).toString(); } private long getReason(int status) { -- cgit v1.2.3-59-g8ed1b