diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 734d050a0..b663480e0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -158,6 +158,11 @@
+
+
+
+
+
diff --git a/src/com/android/email/activity/MessageCompose.java b/src/com/android/email/activity/MessageCompose.java
index 193411a4b..ca61e0ce7 100644
--- a/src/com/android/email/activity/MessageCompose.java
+++ b/src/com/android/email/activity/MessageCompose.java
@@ -72,6 +72,7 @@ import android.widget.Toast;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
+import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -105,6 +106,11 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private static final Pattern PATTERN_START_OF_LINE = Pattern.compile("(?m)^");
private static final Pattern PATTERN_ENDLINE_CRLF = Pattern.compile("\r\n");
+ private static final String[] ATTACHMENT_META_COLUMNS = {
+ OpenableColumns.DISPLAY_NAME,
+ OpenableColumns.SIZE
+ };
+
private Account mAccount;
// mDraft is null until the first save, afterwards it contains the last saved version.
@@ -258,7 +264,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
// Handle the various intents that launch the message composer
if (Intent.ACTION_VIEW.equals(action)
|| Intent.ACTION_SENDTO.equals(action)
- || Intent.ACTION_SEND.equals(action)) {
+ || Intent.ACTION_SEND.equals(action)
+ || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
setAccount(intent);
// Use the fields found in the Intent to prefill as much of the message as possible
initFromIntent(intent);
@@ -800,8 +807,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
String name = null;
ContentResolver contentResolver = getContentResolver();
Cursor metadataCursor = contentResolver.query(uri,
- new String[]{ OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE },
- null, null, null);
+ ATTACHMENT_META_COLUMNS, null, null, null);
if (metadataCursor != null) {
try {
if (metadataCursor.moveToFirst()) {
@@ -1021,6 +1027,23 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
}
}
+
+ if (Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())
+ && intent.hasExtra(Intent.EXTRA_STREAM)) {
+ ArrayList list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
+ if (list != null) {
+ for (Parcelable parcelable : list) {
+ Uri uri = (Uri) parcelable;
+ if (uri != null) {
+ Attachment attachment = loadAttachmentInfo(uri);
+ if (MimeUtility.mimeTypeMatches(attachment.mMimeType,
+ Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) {
+ addAttachment(attachment);
+ }
+ }
+ }
+ }
+ }
// Finally - expose fields that were filled in but are normally hidden, and set focus