summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWei Huang <weih@google.com>2012-09-09 12:32:26 -0700
committerWei Huang <weih@google.com>2012-09-09 12:37:30 -0700
commit95e0a156327c18f2e9afc72a45a5985ad6ae7abb (patch)
treec356147e83ac9dbbc112bd7afaf74530caf6210c /src
parent67f9035e9a0651b8bf894568aff8a130a17297d8 (diff)
downloadMms-95e0a156327c18f2e9afc72a45a5985ad6ae7abb.tar.gz
bug #7128602: Messaging app crash on choosing to share all the picture attachment received on Gmail
- if we cannot get the mime_type from the "mime_type" column, then try getting it by calling ContentResolver.getType(uri); Change-Id: I510ab2444eaa3bc96e2551cfb659d4afb77d3af6
Diffstat (limited to 'src')
-rw-r--r--src/com/android/mms/ui/UriImage.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/android/mms/ui/UriImage.java b/src/com/android/mms/ui/UriImage.java
index aa0c093d..c74764b5 100644
--- a/src/com/android/mms/ui/UriImage.java
+++ b/src/com/android/mms/ui/UriImage.java
@@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SqliteWrapper;
@@ -110,7 +111,8 @@ public class UriImage {
}
private void initFromContentUri(Context context, Uri uri) {
- Cursor c = SqliteWrapper.query(context, context.getContentResolver(),
+ ContentResolver resolver = context.getContentResolver();
+ Cursor c = SqliteWrapper.query(context, resolver,
uri, null, null, null, null);
mSrc = null;
@@ -140,7 +142,12 @@ public class UriImage {
mContentType = c.getString(
c.getColumnIndexOrThrow(Images.Media.MIME_TYPE)); // mime_type
} catch (IllegalArgumentException e) {
- mContentType = c.getString(c.getColumnIndexOrThrow("mimetype"));
+ try {
+ mContentType = c.getString(c.getColumnIndexOrThrow("mimetype"));
+ } catch (IllegalArgumentException ex) {
+ mContentType = resolver.getType(uri);
+ Log.v(TAG, "initFromContentUri: " + uri + ", getType => " + mContentType);
+ }
}
// use the original filename if possible