summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Lee <anthonylee@google.com>2014-03-06 15:30:43 -0800
committerAnthony Lee <anthonylee@google.com>2014-03-06 16:02:18 -0800
commitc327f272bbef1afbffad4dcbb62cf42880f4c03b (patch)
tree95fa1360d8be3cba59a892cf2646b18e6ac69701
parent10a7c30c1374e452e22be6141ea98f9baacbf7fb (diff)
downloadExchange-c327f272bbef1afbffad4dcbb62cf42880f4c03b.tar.gz
b/9564335. Set maxAttachmentSize on the Account table after receiving
policy information from Exchange. Change-Id: I26c45f077e8c9edabfb3ff19de5ba4bbc27752c4
-rw-r--r--src/com/android/exchange/eas/EasProvision.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/exchange/eas/EasProvision.java b/src/com/android/exchange/eas/EasProvision.java
index 4ea003d1..145fa08d 100644
--- a/src/com/android/exchange/eas/EasProvision.java
+++ b/src/com/android/exchange/eas/EasProvision.java
@@ -16,9 +16,11 @@
package com.android.exchange.eas;
+import android.content.ContentValues;
import android.content.Context;
import com.android.emailcommon.provider.Account;
+import com.android.emailcommon.provider.EmailContent;
import com.android.emailcommon.provider.Policy;
import com.android.emailcommon.service.PolicyServiceProxy;
import com.android.exchange.Eas;
@@ -144,6 +146,18 @@ public class EasProvision extends EasOperation {
}
/**
+ * Write the max attachment size that came out of the policy to the Account table in the db.
+ * Once this value is written, the mapping to Account.Settings.MAX_ATTACHMENT_SIZE was
+ * added to point to this column in this table.
+ * @param maxAttachmentSize The max attachment size value that we want to write to the db.
+ */
+ private void storeMaxAttachmentSize(final int maxAttachmentSize) {
+ final ContentValues values = new ContentValues(1);
+ values.put(EmailContent.AccountColumns.MAX_ATTACHMENT_SIZE, maxAttachmentSize);
+ Account.update(mContext, Account.CONTENT_URI, getAccountId(), values);
+ }
+
+ /**
* Get the required policy from the server and enforce it.
* @return Whether we succeeded in provisioning this account.
*/
@@ -162,6 +176,10 @@ public class EasProvision extends EasOperation {
return false;
}
+ // Even before the policy is accepted, we can honor this setting since it has nothing
+ // to do with the device policy manager and is requested by the Exchange server.
+ storeMaxAttachmentSize(mPolicy.mMaxAttachmentSize);
+
// Apply the policies (that we support) with the temporary key.
mPolicy.mProtocolPoliciesUnsupported = null;
PolicyServiceProxy.setAccountPolicy(mContext, accountId, mPolicy, null);