am 6dd7bd29: Load large POP attachments

* commit '6dd7bd29e97e7190b01bf6325d131f24c097b560':
  Load large POP attachments
This commit is contained in:
Paul Westbrook 2013-07-29 19:17:57 -07:00 committed by Android Git Automerger
commit 009f5a2f4c
3 changed files with 8 additions and 5 deletions

View File

@ -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 ");

View File

@ -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();

View File

@ -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);
}
}