Fix account deletion when removing security policies.
- Delete accounts, not just account data. - Wait for PIM data to get deleted before proceeding. - Reconcile after deleting an account. Bug: 11856902 Change-Id: Ie52b7c583688bf48a33bcf6b4e555b8c055b476c
This commit is contained in:
parent
f0c1242294
commit
a60550e0eb
@ -375,6 +375,10 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService {
|
|||||||
mService.deleteAccountPIMData(emailAddress);
|
mService.deleteAccountPIMData(emailAddress);
|
||||||
}
|
}
|
||||||
}, "deleteAccountPIMData");
|
}, "deleteAccountPIMData");
|
||||||
|
// This can be called when deleting accounts. After making this call, the caller will
|
||||||
|
// ask for account reconciliation, which will kill the processes. We wait for completion
|
||||||
|
// to avoid the race.
|
||||||
|
waitForCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +32,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
import com.android.email.provider.AccountReconciler;
|
||||||
import com.android.email.provider.EmailProvider;
|
import com.android.email.provider.EmailProvider;
|
||||||
import com.android.email.service.EmailBroadcastProcessorService;
|
import com.android.email.service.EmailBroadcastProcessorService;
|
||||||
import com.android.email.service.EmailServiceUtils;
|
import com.android.email.service.EmailServiceUtils;
|
||||||
@ -699,13 +700,14 @@ public class SecurityPolicy {
|
|||||||
" secured account(s)");
|
" secured account(s)");
|
||||||
while (c.moveToNext()) {
|
while (c.moveToNext()) {
|
||||||
long accountId = c.getLong(EmailContent.ID_PROJECTION_COLUMN);
|
long accountId = c.getLong(EmailContent.ID_PROJECTION_COLUMN);
|
||||||
Uri uri = EmailProvider.uiUri("uiaccountdata", accountId);
|
Uri uri = EmailProvider.uiUri("uiaccount", accountId);
|
||||||
cr.delete(uri, null, null);
|
cr.delete(uri, null, null);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
c.close();
|
c.close();
|
||||||
}
|
}
|
||||||
policiesUpdated();
|
policiesUpdated();
|
||||||
|
AccountReconciler.reconcileAccounts(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5499,6 +5499,8 @@ public class EmailProvider extends ContentProvider {
|
|||||||
AccountBackupRestore.backup(context);
|
AccountBackupRestore.backup(context);
|
||||||
SecurityPolicy.getInstance(context).reducePolicies();
|
SecurityPolicy.getInstance(context).reducePolicies();
|
||||||
MailActivityEmail.setServicesEnabledSync(context);
|
MailActivityEmail.setServicesEnabledSync(context);
|
||||||
|
// TODO: We ought to reconcile accounts here, but some callers do this in a loop,
|
||||||
|
// which would be a problem when the first account reconciliation shuts us down.
|
||||||
return 1;
|
return 1;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.w(Logging.LOG_TAG, "Exception while deleting account", e);
|
LogUtils.w(Logging.LOG_TAG, "Exception while deleting account", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user