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
This commit is contained in:
parent
fe82454847
commit
a0b4907ca5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user