summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/UriSource.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-04-27 16:11:58 +0800
committerOwen Lin <owenlin@google.com>2012-04-27 16:11:58 +0800
commit52083a2fcca3007ddde51ccd166d602d95583bee (patch)
tree35e61ed3fc16746f75d05ed869365e9337d11853 /src/com/android/gallery3d/data/UriSource.java
parent9f13c0ec31e748ab7ade660e416efd03b63176fa (diff)
downloadandroid_packages_apps_Snap-52083a2fcca3007ddde51ccd166d602d95583bee.tar.gz
android_packages_apps_Snap-52083a2fcca3007ddde51ccd166d602d95583bee.tar.bz2
android_packages_apps_Snap-52083a2fcca3007ddde51ccd166d602d95583bee.zip
Fix photo rotates incorrectly in crop image.
bug:6399424 Change-Id: Icc0aca5e9abcd643f8e246211e37bd177bf8ff31
Diffstat (limited to 'src/com/android/gallery3d/data/UriSource.java')
-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;
}
}