Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e375fc5c authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 6787

* changes:
  AbstractSyncableContentProvider must only call onAccountsChanged with GAIA accounts
parents 1dcdce6d 45107e0c
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -165,6 +165,20 @@ public abstract class AbstractSyncableContentProvider extends SyncableContentPro
                        // Some providers override onAccountsChanged(); give them a database to
                        // Some providers override onAccountsChanged(); give them a database to
                        // work with.
                        // work with.
                        mDb = mOpenHelper.getWritableDatabase();
                        mDb = mOpenHelper.getWritableDatabase();
                        // Only call onAccountsChanged on GAIA accounts; otherwise, the contacts and
                        // calendar providers will choke as they try to sync unknown accounts with
                        // AbstractGDataSyncAdapter, which will put acore into a crash loop
                        ArrayList<Account> gaiaAccounts = new ArrayList<Account>();
                        for (Account acct: accounts) {
                            if (acct.mType.equals("com.google.GAIA")) {
                                gaiaAccounts.add(acct);
                            }
                        }
                        accounts = new Account[gaiaAccounts.size()];
                        int i = 0;
                        for (Account acct: gaiaAccounts) {
                            accounts[i++] = acct;
                        }
                        onAccountsChanged(accounts);
                        onAccountsChanged(accounts);
                        TempProviderSyncAdapter syncAdapter = getTempProviderSyncAdapter();
                        TempProviderSyncAdapter syncAdapter = getTempProviderSyncAdapter();
                        if (syncAdapter != null) {
                        if (syncAdapter != null) {
@@ -175,7 +189,6 @@ public abstract class AbstractSyncableContentProvider extends SyncableContentPro


        return true;
        return true;
    }
    }

    /**
    /**
     * Get a non-persistent instance of this content provider.
     * Get a non-persistent instance of this content provider.
     * You must call {@link #close} on the returned
     * You must call {@link #close} on the returned