From 2ac4f855ea24afb78aaf52a8644f697f558d9432 Mon Sep 17 00:00:00 2001 From: Andy Stadler Date: Fri, 25 Mar 2011 16:36:11 -0700 Subject: [PATCH] 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 --- src/com/android/email/MessagingController.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index 93334fcb1..b739e86cc 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -1337,10 +1337,10 @@ public class MessagingController implements Runnable { private void processUploadMessage(ContentResolver resolver, Store remoteStore, EmailContent.Account account, Mailbox mailbox, long messageId) throws MessagingException { - EmailContent.Message message = + EmailContent.Message newMessage = EmailContent.Message.restoreMessageWithId(mContext, messageId); boolean deleteUpdate = false; - if (message == null) { + if (newMessage == null) { deleteUpdate = true; Log.d(Email.LOG_TAG, "Upsync failed for null message, id=" + messageId); } else if (mailbox.mType == Mailbox.TYPE_DRAFTS) { @@ -1352,9 +1352,12 @@ public class MessagingController implements Runnable { } else if (mailbox.mType == Mailbox.TYPE_TRASH) { deleteUpdate = false; 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 { 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) { // Finally, delete the update (if any)