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

Commit 50fdbef2 authored by Fred Quintana's avatar Fred Quintana Committed by Android (Google) Code Review
Browse files

Merge "Clean the settings for the account/authority when trying to sync an...

Merge "Clean the settings for the account/authority when trying to sync an adapter that is not installed."
parents 44113ba3 7620f1ae
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1610,7 +1610,9 @@ public class SyncManager implements OnAccountsUpdateListener {
            RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterInfo =
                    mSyncAdapters.getServiceInfo(syncAdapterType);
            if (syncAdapterInfo == null) {
                Log.d(TAG, "can't find a sync adapter for " + syncAdapterType);
                Log.d(TAG, "can't find a sync adapter for " + syncAdapterType
                        + ", removing settings for it");
                mSyncStorageEngine.removeAuthority(op.account, op.authority);
                runStateIdle();
                return;
            }
+16 −1
Original line number Diff line number Diff line
@@ -643,6 +643,12 @@ public class SyncStorageEngine extends Handler {
        }
    }

    public void removeAuthority(Account account, String authority) {
        synchronized (mAuthorities) {
            removeAuthorityLocked(account, authority);
        }
    }

    public AuthorityInfo getAuthority(int authorityId) {
        synchronized (mAuthorities) {
            return mAuthorities.get(authorityId);
@@ -1272,6 +1278,15 @@ public class SyncStorageEngine extends Handler {
        return authority;
    }

    private void removeAuthorityLocked(Account account, String authorityName) {
        AccountInfo accountInfo = mAccounts.get(account);
        if (accountInfo != null) {
            if (accountInfo.authorities.remove(authorityName) != null) {
                writeAccountInfoLocked();
            }
        }
    }

    public SyncStatusInfo getOrCreateSyncStatus(AuthorityInfo authority) {
        synchronized (mAuthorities) {
            return getOrCreateSyncStatusLocked(authority.ident);