Support eml attachments in email.

Change-Id: I76274540d00a292d5a8f777d75d8e9f7b2ef3a51
This commit is contained in:
Andrew Sapperstein 2013-06-21 11:30:49 -07:00
parent a54ee609cd
commit 478417a794
3 changed files with 19 additions and 2 deletions

View File

@ -354,6 +354,14 @@
<grant-uri-permission android:pathPattern=".*" />
</provider>
<provider
android:authorities="@string/eml_attachment_provider"
android:multiprocess="false"
android:exported="false"
android:name="com.android.mail.providers.EmlAttachmentProvider" >
<grant-uri-permission android:pathPattern=".*" />
</provider>
<!-- The android:name is the name of the Provider class which is stored in
UnifiedEmail, and has package name com.android.mail.providers and the class is
called SuggestionsProvider. The authority name is specified in the MailAppProvider
@ -698,6 +706,7 @@
</service>
<service android:name="com.android.mail.MailLogService">
</service>
<service android:name="com.android.mail.browse.EmlTempFileDeletionService" />
</application>
<!-- Legacy permissions, etc. can go here -->

View File

@ -1283,4 +1283,7 @@ as <xliff:g id="filename">%s</xliff:g>.</string>
<string name="protocol_pop3" translatable="false">pop3</string>
<string name="protocol_eas" translatable="false">eas</string>
<string name="application_mime_type" translatable="false">application/email-ls</string>
<!-- Content Provider Authority for Eml Attachments -->
<string name="eml_attachment_provider" translatable="false">com.android.email.provider.eml.attachment</string>
</resources>

View File

@ -2998,7 +2998,10 @@ public class EmailProvider extends ContentProvider {
*/
private static String genQueryAttachments(String[] uiProjection,
List<String> contentTypeQueryParameters) {
StringBuilder sb = genSelect(getAttachmentMap(), uiProjection);
// MAKE SURE THESE VALUES STAY IN SYNC WITH GEN QUERY ATTACHMENT
ContentValues values = new ContentValues(1);
values.put(UIProvider.AttachmentColumns.SUPPORTS_DOWNLOAD_AGAIN, 1);
StringBuilder sb = genSelect(getAttachmentMap(), uiProjection, values);
sb.append(" FROM " + Attachment.TABLE_NAME + " WHERE " + AttachmentColumns.MESSAGE_KEY +
" =? ");
@ -3032,9 +3035,11 @@ public class EmailProvider extends ContentProvider {
private String genQueryAttachment(String[] uiProjection, String idString) {
Long id = Long.parseLong(idString);
Attachment att = Attachment.restoreAttachmentWithId(getContext(), id);
ContentValues values = new ContentValues();
// MAKE SURE THESE VALUES STAY IN SYNC WITH GEN QUERY ATTACHMENTS
ContentValues values = new ContentValues(2);
values.put(AttachmentColumns.CONTENT_URI,
AttachmentUtilities.getAttachmentUri(att.mAccountKey, id).toString());
values.put(UIProvider.AttachmentColumns.SUPPORTS_DOWNLOAD_AGAIN, 1);
StringBuilder sb = genSelect(getAttachmentMap(), uiProjection, values);
sb.append(" FROM " + Attachment.TABLE_NAME + " WHERE " + AttachmentColumns.ID + " =? ");
return sb.toString();