summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-05-02 00:31:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-02 00:31:16 -0700
commiteea90e65dcfcd1c9b2c8cfcbb9b20855f380a72a (patch)
treeb84497e50cc6e1f6857c602158802683e7d959b9 /src
parent814360ae97d59e333440076b5517fff0c6be5ca9 (diff)
parentbe6e69c8d57f63a96b14237b943ab5ae6343813e (diff)
downloadandroid_packages_apps_Gallery2-eea90e65dcfcd1c9b2c8cfcbb9b20855f380a72a.tar.gz
android_packages_apps_Gallery2-eea90e65dcfcd1c9b2c8cfcbb9b20855f380a72a.tar.bz2
android_packages_apps_Gallery2-eea90e65dcfcd1c9b2c8cfcbb9b20855f380a72a.zip
Merge "Fix photo rotates incorrectly in crop image." into jb-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/data/UriSource.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/data/UriSource.java b/src/com/android/gallery3d/data/UriSource.java
index 76f7ac0e5..d37c51d13 100644
--- a/src/com/android/gallery3d/data/UriSource.java
+++ b/src/com/android/gallery3d/data/UriSource.java
@@ -28,6 +28,8 @@ import java.net.URLEncoder;
class UriSource extends MediaSource {
@SuppressWarnings("unused")
private static final String TAG = "UriSource";
+ private static final String IMAGE_TYPE_PREFIX = "image/";
+ private static final String IMAGE_TYPE_ANY = "image/*";
private GalleryApp mApplication;
@@ -64,11 +66,19 @@ class UriSource extends MediaSource {
@Override
public Path findPathByUri(Uri uri, String type) {
- if (type == null) type = getMimeType(uri);
- if (type.startsWith("image/")) {
+ String mimeType = getMimeType(uri);
+
+ // Try to find a most specific type but it has to be started with "image/"
+ if ((type == null) || (IMAGE_TYPE_ANY.equals(type)
+ && mimeType.startsWith(IMAGE_TYPE_PREFIX))) {
+ type = mimeType;
+ }
+
+ if (type.startsWith(IMAGE_TYPE_PREFIX)) {
return Path.fromString("/uri/" + URLEncoder.encode(uri.toString())
+ "/" +URLEncoder.encode(type));
}
+ // We have no clues that it is an image
return null;
}
}