From a0b4907ca5b082962bd596fba29d2c8649386cf2 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Sat, 20 Mar 2010 22:07:55 -0700 Subject: [PATCH] Fix race condition that results in incomplete accounts * Remove some very old code that updated the Account in the database when finishing an EAS FolderSync. The old code saved away the entire Account structure using getContentValues(), which has long been recognized as dangerous, since the data being saved might be stale. * In this case, we were clearing the INCOMPLETE flag in another thread, but FolderSync was saving away the old value (with INCOMPLETE set) along with all of the other columns. * Ironically, the old code is entirely obsolete, so the solution is to simply remove the update call. Bug: 2501574 Change-Id: I9eccbde40e05c83ec5f0ab1d3387289286acc5f3 --- src/com/android/exchange/adapter/FolderSyncParser.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/com/android/exchange/adapter/FolderSyncParser.java b/src/com/android/exchange/adapter/FolderSyncParser.java index 50ecea6cb..ed97d315e 100644 --- a/src/com/android/exchange/adapter/FolderSyncParser.java +++ b/src/com/android/exchange/adapter/FolderSyncParser.java @@ -20,7 +20,6 @@ package com.android.exchange.adapter; import com.android.email.provider.AttachmentProvider; import com.android.email.provider.EmailContent; import com.android.email.provider.EmailProvider; -import com.android.email.provider.EmailContent.Account; import com.android.email.provider.EmailContent.AccountColumns; import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.MailboxColumns; @@ -334,12 +333,7 @@ public class FolderSyncParser extends AbstractSyncParser { if (!ops.isEmpty() && !mService.isStopped()) { userLog("Applying ", ops.size(), " mailbox operations."); - // Then, we create an update for the account (most importantly, updating the syncKey) - ops.add(ContentProviderOperation.newUpdate( - ContentUris.withAppendedId(Account.CONTENT_URI, mAccountId)).withValues( - mAccount.toContentValues()).build()); - - // Finally, we execute the batch + // Execute the batch try { mContentResolver.applyBatch(EmailProvider.EMAIL_AUTHORITY, ops); userLog("New Account SyncKey: ", mAccount.mSyncKey);