From 39edfeb8405f263193c330a1aed092468c0c4ccd Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Mon, 9 Apr 2012 20:07:07 -0700 Subject: [PATCH] Add attachments to ui messages Bug: 6309686 Change-Id: If3d25e6273c453b99aa0acfcca8e7d5636c7de3a --- .../android/email/provider/EmailProvider.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/email2/src/com/android/email/provider/EmailProvider.java b/email2/src/com/android/email/provider/EmailProvider.java index a16613177..18c2fbd83 100644 --- a/email2/src/com/android/email/provider/EmailProvider.java +++ b/email2/src/com/android/email/provider/EmailProvider.java @@ -2243,6 +2243,24 @@ outer: } values.put(UIProvider.MessageColumns.ALWAYS_SHOW_IMAGES, autoShowImages); + // Add attachments... + Attachment[] atts = Attachment.restoreAttachmentsWithMessageId(context, messageId); + if (atts.length > 0) { + ArrayList uiAtts = + new ArrayList(); + for (Attachment att: atts) { + com.android.mail.providers.Attachment uiAtt = + new com.android.mail.providers.Attachment(); + uiAtt.name = att.mFileName; + uiAtt.contentType = att.mMimeType; + uiAtt.size = (int)att.mSize; + uiAtt.uri = uiUri("uiattachment", att.mId); + uiAtts.add(uiAtt); + } + values.put(UIProvider.MessageColumns.ATTACHMENTS, + com.android.mail.providers.Attachment.toJSONArray(uiAtts)); + } + StringBuilder sb = genSelect(sMessageViewMap, uiProjection, values); sb.append(" FROM " + Message.TABLE_NAME + "," + Body.TABLE_NAME + " WHERE " + Body.MESSAGE_KEY + "=" + Message.TABLE_NAME + "." + Message.RECORD_ID + " AND " +