From a6f694635f8989d3e5d8f0d0ac46c39f1a12edb7 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Sat, 4 Sep 2010 16:38:08 -0700 Subject: [PATCH] DO NOT MERGE: Fix repeating notifications for synced messages * Existing code reloads long POP/IMAP messages at every sync * If the server is POP3, or the IMAP message is unread, this will lead to redundant notifications of new message arrival * The fix avoids repeated message reload * Backport of I8dc22966282655c8645362d672a083a1c37f554c (master) Bug: 2892705 Change-Id: I1ce7de0dc25abc8ace544849dc3d437fcd1459f0 --- src/com/android/email/MessagingController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index c04280f25..3ac6f7c9e 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -572,9 +572,14 @@ public class MessagingController implements Runnable { if (localMessage == null) { newMessageCount++; } - if (localMessage == null - || (localMessage.mFlagLoaded == EmailContent.Message.FLAG_LOADED_UNLOADED) - || (localMessage.mFlagLoaded == EmailContent.Message.FLAG_LOADED_PARTIAL)) { + // localMessage == null -> message has never been created (not even headers) + // mFlagLoaded = UNLOADED -> message created, but none of body loaded + // mFlagLoaded = PARTIAL -> message created, a "sane" amt of body has been loaded + // mFlagLoaded = COMPLETE -> message body has been completely loaded + // mFlagLoaded = DELETED -> message has been deleted + // Only the first two of these are "unsynced", so let's retrieve them + if (localMessage == null || + (localMessage.mFlagLoaded == EmailContent.Message.FLAG_LOADED_UNLOADED)) { unsyncedMessages.add(message); } }