Don't save Policy with Account

Change-Id: Ib3601daee8780640a07db573f623e99279c9f9b1
This commit is contained in:
Marc Blank 2011-11-21 13:04:26 -08:00
parent 5789a78af3
commit fd81e19779
2 changed files with 2 additions and 17 deletions

View File

@ -762,7 +762,6 @@ public final class Account extends EmailContent implements AccountColumns, Parce
int index = 0;
int recvIndex = -1;
int sendIndex = -1;
int policyIndex = -1;
// Create operations for saving the send and recv hostAuths
// Also, remember which operation in the array they represent
@ -779,12 +778,6 @@ public final class Account extends EmailContent implements AccountColumns, Parce
.withValues(mHostAuthSend.toContentValues())
.build());
}
if (mPolicy != null) {
policyIndex = index++;
ops.add(ContentProviderOperation.newInsert(mPolicy.mBaseUri)
.withValues(mPolicy.toContentValues())
.build());
}
// Create operations for making this the only default account
// Note, these are always updates because they change existing accounts
@ -797,7 +790,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce
// Now do the Account
ContentValues cv = null;
if (recvIndex >= 0 || sendIndex >= 0 || policyIndex >= 0) {
if (recvIndex >= 0 || sendIndex >= 0) {
cv = new ContentValues();
if (recvIndex >= 0) {
cv.put(Account.HOST_AUTH_KEY_RECV, recvIndex);
@ -805,9 +798,6 @@ public final class Account extends EmailContent implements AccountColumns, Parce
if (sendIndex >= 0) {
cv.put(Account.HOST_AUTH_KEY_SEND, sendIndex);
}
if (policyIndex >= 0) {
cv.put(Account.POLICY_KEY, policyIndex);
}
}
ContentProviderOperation.Builder b = ContentProviderOperation.newInsert(mBaseUri);
@ -831,11 +821,6 @@ public final class Account extends EmailContent implements AccountColumns, Parce
mHostAuthKeySend = newId;
mHostAuthSend.mId = newId;
}
if (policyIndex >= 0) {
long newId = getId(results[policyIndex].uri);
mPolicyKey = newId;
mPolicy.mId = newId;
}
Uri u = results[index].uri;
mId = getId(u);
return u;

View File

@ -564,7 +564,7 @@ public class SecurityPolicy {
if (account.mPolicyKey > 0) {
oldPolicy = Policy.restorePolicyWithId(mContext, account.mPolicyKey);
}
boolean policyChanged = !oldPolicy.equals(policy);
boolean policyChanged = (oldPolicy == null) || !oldPolicy.equals(policy);
if (!policyChanged && (TextUtilities.stringOrNullEquals(securityKey,
account.mSecuritySyncKey))) {
Log.d(Logging.LOG_TAG, "setAccountPolicy; policy unchanged");