Match against both account name and type when reconciling accounts

b/10210901

Change-Id: Ice60ab64a2f7287be9ee639e5777f85bda4bd390
This commit is contained in:
Tony Mantler 2013-09-25 13:34:04 -07:00
parent 99b023353d
commit ed0ee50a12
1 changed files with 6 additions and 3 deletions

View File

@ -110,9 +110,9 @@ public class AccountReconciler {
* @return Whether the account is in the list.
*/
private static boolean hasAmAccount(final List<android.accounts.Account> accounts,
final String name) {
final String name, final String type) {
for (final android.accounts.Account account : accounts) {
if (account.name.equalsIgnoreCase(name)) {
if (account.name.equalsIgnoreCase(name) && account.type.equalsIgnoreCase(type)) {
return true;
}
}
@ -154,7 +154,10 @@ public class AccountReconciler {
// AccountManager account
for (final Account providerAccount : emailProviderAccounts) {
final String providerAccountName = providerAccount.mEmailAddress;
if (!hasAmAccount(accountManagerAccounts, providerAccountName)) {
final String providerAccountType =
EmailServiceUtils.getServiceInfoForAccount(context, providerAccount.mId)
.accountType;
if (!hasAmAccount(accountManagerAccounts, providerAccountName, providerAccountType)) {
if ((providerAccount.mFlags & Account.FLAGS_INCOMPLETE) != 0) {
LogUtils.w(Logging.LOG_TAG,
"Account reconciler noticed incomplete account; ignoring");