diff options
author | Danny Baumann <dannybaumann@web.de> | 2017-05-24 21:09:08 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2017-05-24 21:19:48 +0200 |
commit | c43715b871b7e9309cc97774c6ce127e7cfcc990 (patch) | |
tree | df8c33c7359b420fa35b1b57a5bb6330d4731402 | |
parent | c0e5d54c041466ebc97b6279d717f8770dd36690 (diff) | |
download | android_packages_apps_Email-c43715b871b7e9309cc97774c6ce127e7cfcc990.tar.gz android_packages_apps_Email-c43715b871b7e9309cc97774c6ce127e7cfcc990.tar.bz2 android_packages_apps_Email-c43715b871b7e9309cc97774c6ce127e7cfcc990.zip |
Fix message duplication on flag update.
When updating e.g. the 'seen' flag of a message, it might happen that a
duplicate for that message is created. Root cause was that the wrong
local message for the remote message was put into the cache map, which
later led to message lookup failure, which made the code believe the
message still needs to be downloaded (again).
Additionally, ghost messages could be created after deleting messages
when the IDLE connection reported the 'deleted' flag being set after
doing the deletion locally. In that case, the local message was supposed
to not be present in the lookup map, but the remote message list was not
updated correctly to reflect the deletion.
Change-Id: I954ea65cfe17b11a7f9ba19020399ac8cc6c3745
-rwxr-xr-x | provider_src/com/android/email/service/ImapService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/provider_src/com/android/email/service/ImapService.java b/provider_src/com/android/email/service/ImapService.java index 88de6997d..8d8dbd41f 100755 --- a/provider_src/com/android/email/service/ImapService.java +++ b/provider_src/com/android/email/service/ImapService.java @@ -1784,7 +1784,7 @@ public class ImapService extends Service { LocalMessageInfo.PROJECTION, EmailContent.MessageColumns.ACCOUNT_KEY + "=?" + " AND " + MessageColumns.MAILBOX_KEY + "=?" - + " AND " + MessageColumns.SERVER_ID + ">=?", + + " AND " + MessageColumns.SERVER_ID + "=?", new String[] { String.valueOf(acct.mId), String.valueOf(mailbox.mId), @@ -1878,6 +1878,9 @@ public class ImapService extends Service { // Attachment & Body records are auto-deleted when we delete the Message record AttachmentUtilities.deleteAllAttachmentFiles(ctx, acct.mId, info.mId); + // Make sure we don't sync deleted messages we just got a flag update for + unsyncedMessages.remove(remoteMessage); + // Delete the message itself final Uri uriToDelete = ContentUris.withAppendedId( EmailContent.Message.CONTENT_URI, info.mId); |