DO NOT MERGE - Don't sync messages moved from the sent folder

Modified location of the test to processUploadMessage() method. We do this to
prevent creating multiple EmailContent.Message objects.

Bug: 4096266
Backport from: Id83d3703283c0cd89a60c6210976093d39fb6934

Change-Id: Ie0e9c52182df96617cc942235135ef5ccf865d41
This commit is contained in:
Andy Stadler 2011-03-25 16:36:11 -07:00
parent 8f0a79c2ef
commit 2ac4f855ea

View File

@ -1337,10 +1337,10 @@ public class MessagingController implements Runnable {
private void processUploadMessage(ContentResolver resolver, Store remoteStore, private void processUploadMessage(ContentResolver resolver, Store remoteStore,
EmailContent.Account account, Mailbox mailbox, long messageId) EmailContent.Account account, Mailbox mailbox, long messageId)
throws MessagingException { throws MessagingException {
EmailContent.Message message = EmailContent.Message newMessage =
EmailContent.Message.restoreMessageWithId(mContext, messageId); EmailContent.Message.restoreMessageWithId(mContext, messageId);
boolean deleteUpdate = false; boolean deleteUpdate = false;
if (message == null) { if (newMessage == null) {
deleteUpdate = true; deleteUpdate = true;
Log.d(Email.LOG_TAG, "Upsync failed for null message, id=" + messageId); Log.d(Email.LOG_TAG, "Upsync failed for null message, id=" + messageId);
} else if (mailbox.mType == Mailbox.TYPE_DRAFTS) { } else if (mailbox.mType == Mailbox.TYPE_DRAFTS) {
@ -1352,9 +1352,12 @@ public class MessagingController implements Runnable {
} else if (mailbox.mType == Mailbox.TYPE_TRASH) { } else if (mailbox.mType == Mailbox.TYPE_TRASH) {
deleteUpdate = false; deleteUpdate = false;
Log.d(Email.LOG_TAG, "Upsync skipped for mailbox=trash, id=" + messageId); Log.d(Email.LOG_TAG, "Upsync skipped for mailbox=trash, id=" + messageId);
} else if (newMessage != null && newMessage.mMailboxKey != mailbox.mId) {
deleteUpdate = false;
Log.d(Email.LOG_TAG, "Upsync skipped; mailbox changed, id=" + messageId);
} else { } else {
Log.d(Email.LOG_TAG, "Upsyc triggered for message id=" + messageId); Log.d(Email.LOG_TAG, "Upsyc triggered for message id=" + messageId);
deleteUpdate = processPendingAppend(remoteStore, account, mailbox, message); deleteUpdate = processPendingAppend(remoteStore, account, mailbox, newMessage);
} }
if (deleteUpdate) { if (deleteUpdate) {
// Finally, delete the update (if any) // Finally, delete the update (if any)