From 6dd7bd29e97e7190b01bf6325d131f24c097b560 Mon Sep 17 00:00:00 2001 From: Paul Westbrook Date: Mon, 29 Jul 2013 17:02:27 -0700 Subject: [PATCH] Load large POP attachments Load large attachments from a partial POP message There will be a new change that improves the UI for loading the rest of the message Bug: 8651782 Change-Id: I075de1e82e27cf2018607eef50143850e8fecaf2 --- src/com/android/email/provider/EmailProvider.java | 4 ++-- src/com/android/email/provider/Utilities.java | 4 +++- src/com/android/email/service/Pop3Service.java | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 04cde81c9..50e83d5f3 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2250,7 +2250,7 @@ public class EmailProvider extends ContentProvider { private static String genQueryMailboxMessages(String[] uiProjection, final boolean unseenOnly) { StringBuilder sb = genSelect(getMessageListMap(), uiProjection); sb.append(" FROM " + Message.TABLE_NAME + " WHERE " + - Message.FLAG_LOADED + "=" + Message.FLAG_LOADED_COMPLETE + " AND " + + Message.FLAG_LOADED_SELECTION + " AND " + Message.MAILBOX_KEY + "=? "); if (unseenOnly) { sb.append("AND ").append(MessageColumns.FLAG_SEEN).append(" = 0 "); @@ -2276,7 +2276,7 @@ public class EmailProvider extends ContentProvider { final String[] selectionArgs; StringBuilder sb = genSelect(getMessageListMap(), uiProjection, values); sb.append(" FROM " + Message.TABLE_NAME + " WHERE " + - Message.FLAG_LOADED + "=" + Message.FLAG_LOADED_COMPLETE + " AND "); + Message.FLAG_LOADED_SELECTION + " AND "); if (isCombinedMailbox(mailboxId)) { if (unseenOnly) { sb.append(MessageColumns.FLAG_SEEN).append("=0 AND "); diff --git a/src/com/android/email/provider/Utilities.java b/src/com/android/email/provider/Utilities.java index c21bfa94d..c89e186aa 100644 --- a/src/com/android/email/provider/Utilities.java +++ b/src/com/android/email/provider/Utilities.java @@ -133,7 +133,9 @@ public class Utilities { saveOrUpdate(body, context); // process (and save) attachments - if (loadStatus != EmailContent.Message.FLAG_LOADED_UNKNOWN) { + if (loadStatus != EmailContent.Message.FLAG_LOADED_PARTIAL + && loadStatus != EmailContent.Message.FLAG_LOADED_UNKNOWN) { + // TODO(pwestbro): What should happen with unknown status? LegacyConversions.updateAttachments(context, localMessage, attachments); } else { EmailContent.Attachment att = new EmailContent.Attachment(); diff --git a/src/com/android/email/service/Pop3Service.java b/src/com/android/email/service/Pop3Service.java index 8de7564a4..1d0c03569 100644 --- a/src/com/android/email/service/Pop3Service.java +++ b/src/com/android/email/service/Pop3Service.java @@ -215,7 +215,7 @@ public class Pop3Service extends Service { // 1) Partial messages are shown in the conversation list // 2) We are able to download the rest of the message/attachment when the // user requests it. - flag = EmailContent.Message.FLAG_LOADED_UNKNOWN; + flag = EmailContent.Message.FLAG_LOADED_PARTIAL; } if (MailActivityEmail.DEBUG) { LogUtils.d(TAG, "Message is " + (message.isComplete() ? "" : "NOT ") @@ -363,7 +363,8 @@ public class Pop3Service extends Service { // localMessage == null -> message has never been created (not even headers) // mFlagLoaded != FLAG_LOADED_COMPLETE -> message failed to sync completely if (localMessage == null || - (localMessage.mFlagLoaded != EmailContent.Message.FLAG_LOADED_COMPLETE)) { + (localMessage.mFlagLoaded != EmailContent.Message.FLAG_LOADED_COMPLETE && + localMessage.mFlagLoaded != Message.FLAG_LOADED_PARTIAL)) { unsyncedMessages.add(message); } }