From 940a335bab634a849b45f62d711601d57f59aeb1 Mon Sep 17 00:00:00 2001 From: Yu Ping Hu Date: Fri, 16 Aug 2013 17:46:01 -0700 Subject: [PATCH] Fix attachments when policies change. This used to be done in the Exchange code, but it's more appropriate here. Change-Id: Ie2bd5722bda46741d367eef3a2e9d2493c3cc4e3 --- src/com/android/email/SecurityPolicy.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/android/email/SecurityPolicy.java b/src/com/android/email/SecurityPolicy.java index 60ecbced9..7b73eb74e 100644 --- a/src/com/android/email/SecurityPolicy.java +++ b/src/com/android/email/SecurityPolicy.java @@ -590,6 +590,15 @@ public class SecurityPolicy { if (account.mPolicyKey > 0) { oldPolicy = Policy.restorePolicyWithId(mContext, account.mPolicyKey); } + + // If attachment policies have changed, fix up any affected attachment records + if (oldPolicy != null && securityKey != null) { + if ((oldPolicy.mDontAllowAttachments != policy.mDontAllowAttachments) || + (oldPolicy.mMaxAttachmentSize != policy.mMaxAttachmentSize)) { + Policy.setAttachmentFlagsForNewPolicy(mContext, account, policy); + } + } + boolean policyChanged = (oldPolicy == null) || !oldPolicy.equals(policy); if (!policyChanged && (TextUtilities.stringOrNullEquals(securityKey, account.mSecuritySyncKey))) {