From 7e492a05053aed9816803a797fb53f8e526ed18b Mon Sep 17 00:00:00 2001 From: Matthew Brace Date: Thu, 12 Feb 2009 22:59:02 +0000 Subject: [PATCH] Prevent needlessly downloading every message > 5K the first time it's opened (affected POP3 and WebDav) --- src/com/android/email/MessagingController.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index 1aa5194ba..e49766bc7 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -1007,9 +1007,19 @@ s * critical data as fast as possible, and then we'll fill in the de Message localMessage = localFolder.getMessage(message.getUid()); - // Set a flag indicating that the message has been partially downloaded and - // is ready for view. - localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true); + /* + * Mark the message as fully downloaded if the message size is smaller than + * the FETCH_BODY_SANE_SUGGESTED_SIZE, otherwise mark as only a partial + * download. This will prevent the system from downloading the same message + * twice. + */ + if (message.getSize() < Store.FETCH_BODY_SANE_SUGGESTED_SIZE) { + localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true); + } else { + // Set a flag indicating that the message has been partially downloaded and + // is ready for view. + localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true); + } } else { /* * We have a structure to deal with, from which