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

Commit 75256476 authored by Matthew Williams's avatar Matthew Williams Committed by Android (Google) Code Review
Browse files

Merge "fix deadlock caused by clearAllBackoffs in SSE" into klp-dev

parents a9f97a0a ed37b93a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -315,7 +315,9 @@ public class SyncManager {
                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "Reconnection detected: clearing all backoffs");
                    }
                    mSyncStorageEngine.clearAllBackoffs(mSyncQueue);
                    synchronized(mSyncQueue) {
                        mSyncStorageEngine.clearAllBackoffsLocked(mSyncQueue);
                    }
                }
                sendCheckAlarmsMessage();
            }
+22 −19
Original line number Diff line number Diff line
@@ -710,10 +710,14 @@ public class SyncStorageEngine extends Handler {
        }
    }

    public void clearAllBackoffs(SyncQueue syncQueue) {
    /**
     * Callers of this function need to hold a lock for syncQueue object passed in. Bear in mind
     * this function grabs the lock for {@link #mAuthorities}
     * @param syncQueue queue containing pending sync operations.
     */
    public void clearAllBackoffsLocked(SyncQueue syncQueue) {
        boolean changed = false;
        synchronized (mAuthorities) {
            synchronized (syncQueue) {
            for (AccountInfo accountInfo : mAccounts.values()) {
                for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
                    if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE
@@ -735,7 +739,6 @@ public class SyncStorageEngine extends Handler {
                }
            }
        }
        }

        if (changed) {
            reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);