Allow acceptable media types only for sharing am: a8b76eafc4 am: 505f307d1b

Change-Id: Ia113b3b912f6a1fe345dda541546e5a203ef0ffe
diff --git a/src/com/android/messaging/datamodel/data/MessagePartData.java b/src/com/android/messaging/datamodel/data/MessagePartData.java
index 5846c97..ea24876 100644
--- a/src/com/android/messaging/datamodel/data/MessagePartData.java
+++ b/src/com/android/messaging/datamodel/data/MessagePartData.java
@@ -341,6 +341,11 @@
         return mHeight;
     }
 
+    public static boolean isSupportedMediaType(final String contentType) {
+        return ContentType.isVCardType(contentType)
+                || Arrays.asList(ACCEPTABLE_GALLERY_MEDIA_TYPES).contains(contentType);
+    }
+
     /**
     *
     * @return true if this part can only exist by itself, with no other attachments
diff --git a/src/com/android/messaging/ui/conversationlist/ShareIntentActivity.java b/src/com/android/messaging/ui/conversationlist/ShareIntentActivity.java
index 25d5ea3..412177e 100644
--- a/src/com/android/messaging/ui/conversationlist/ShareIntentActivity.java
+++ b/src/com/android/messaging/ui/conversationlist/ShareIntentActivity.java
@@ -103,7 +103,7 @@
                 }
                 mDraftMessage =
                         sharedText != null ? MessageData.createSharedMessage(sharedText) : null;
-            } else if (ContentType.isMediaType(contentType)) {
+            } else if (PendingAttachmentData.isSupportedMediaType(contentType)) {
                 if (contentUri != null) {
                     mDraftMessage = MessageData.createSharedMessage(null);
                     addSharedPartToDraft(contentType, contentUri);
@@ -139,7 +139,7 @@
                             }
                             strBuffer.append(sharedText);
                         }
-                    } else if (ContentType.isMediaType(actualContentType)) {
+                    } else if (PendingAttachmentData.isSupportedMediaType(actualContentType)) {
                         uriMap.put(uri, actualContentType);
                     } else {
                         // Unsupported content type.