am ea69cbe5: Merge "Fix attachments when policies change." into jb-ub-mail-ur10

* commit 'ea69cbe533eb09c0264082dd2370f5d6d8c47fda':
  Fix attachments when policies change.
This commit is contained in:
Yu Ping Hu 2013-08-16 19:28:42 -07:00 committed by Android Git Automerger
commit ebe2c556e2

View File

@ -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))) {