diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2012-09-20 11:16:46 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2012-09-26 12:04:45 -0700 |
commit | 79bf0a2c14fdc552db1d36f9fbc0500013af96bf (patch) | |
tree | cf9ea675eb09eaaf56d1a038afacb0c1551560eb /src/com/android | |
parent | fb0e11a104271fb7455e929094361a972d966508 (diff) | |
download | android_packages_apps_Snap-79bf0a2c14fdc552db1d36f9fbc0500013af96bf.tar.gz android_packages_apps_Snap-79bf0a2c14fdc552db1d36f9fbc0500013af96bf.tar.bz2 android_packages_apps_Snap-79bf0a2c14fdc552db1d36f9fbc0500013af96bf.zip |
Fixed behavior for back key when viewing download.
Bug: 7205463
Bug: 7164238
Bug: 7175040
When viewing an image via the download notification from browser,
changed the default behavior of the back key to take the user to
the downloads folder.
Change-Id: Ia842bfa0f23c3b0ba767e3f0447add2c9b2cc6a7
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/gallery3d/data/UriSource.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/data/UriSource.java b/src/com/android/gallery3d/data/UriSource.java index f66bacd7b..624747166 100644 --- a/src/com/android/gallery3d/data/UriSource.java +++ b/src/com/android/gallery3d/data/UriSource.java @@ -21,6 +21,7 @@ import android.net.Uri; import android.webkit.MimeTypeMap; import com.android.gallery3d.app.GalleryApp; +import com.android.gallery3d.util.MediaSetUtils; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -35,6 +36,22 @@ class UriSource extends MediaSource { private GalleryApp mApplication; + //Array of accepted Uri paths + private static final String[] ALLOWED_URIS = { + "content://downloads/all_downloads/" + }; + + private static boolean checkIfUriStringAllowed(String uri){ + boolean ret = false; + for(String u : ALLOWED_URIS) { + if (uri.startsWith(u)){ + ret = true; + break; + } + } + return ret; + } + public UriSource(GalleryApp context) { super("uri"); mApplication = context; @@ -71,6 +88,21 @@ class UriSource extends MediaSource { } @Override + public Path getDefaultSetOf(Path item) { + MediaObject object = mApplication.getDataManager().getMediaObject(item); + if (object instanceof UriImage) { + //Check if Uri path is for an item that should appear + //in the downloads folder (checks against ALLOWED_URIS). + String uri = ((UriImage)object).getContentUri().toString(); + if(!checkIfUriStringAllowed(uri)) + return null; + return Path.fromString("/local/all").getChild( + MediaSetUtils.DOWNLOAD_BUCKET_ID); + } + return null; + } + + @Override public Path findPathByUri(Uri uri, String type) { String mimeType = getMimeType(uri); |