From 47925465841af09b60fff7027132ceacec2933b7 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Sat, 15 Sep 2012 10:33:37 -0700 Subject: [PATCH] Don't delete smart-forward attachments Bug: 7115207 Change-Id: I3f0782a01e9faa83834e5abbaf40cdb2ac0f8718 --- .../src/com/android/emailcommon/utility/Utility.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emailcommon/src/com/android/emailcommon/utility/Utility.java b/emailcommon/src/com/android/emailcommon/utility/Utility.java index 111553eba..28d0b41e9 100644 --- a/emailcommon/src/com/android/emailcommon/utility/Utility.java +++ b/emailcommon/src/com/android/emailcommon/utility/Utility.java @@ -792,6 +792,16 @@ public class Utility { Attachment.FLAG_DOWNLOAD_USER_REQUEST)) == 0) { Log.d(Logging.LOG_TAG, "Unloaded attachment isn't marked for download: " + att.mFileName + ", #" + att.mId); + Account acct = Account.restoreAccountWithId(context, msg.mAccountKey); + if (acct == null) return true; + // If smart forward is set and the message is a forward, we'll act as though + // the attachment has been loaded + // In Email1 this test wasn't necessary, as the UI handled it... + if ((msg.mFlags & Message.FLAG_TYPE_FORWARD) != 0) { + if ((acct.mFlags & Account.FLAGS_SUPPORTS_SMART_FORWARD) != 0) { + continue; + } + } Attachment.delete(context, Attachment.CONTENT_URI, att.mId); } else if (att.getContentUri() != null) { // In this case, the attachment file is gone from the cache; let's clear the