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

Commit 119aac93 authored by Matthew Williams's avatar Matthew Williams
Browse files

Fix deadlock caused by clearAllBackoffs in SSE

BUG: 17420163
This CL is a copy of ag/359292
That commit was lost, see the bug for more details.

Change-Id: I68747d447f8c95e6b5022f9bc8cbab677e0c3d4e
parent 485f2095
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -311,7 +311,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();
            }
+2 −4
Original line number Diff line number Diff line
@@ -834,17 +834,16 @@ public class SyncStorageEngine extends Handler {
        return changed;
    }

    public void clearAllBackoffs(SyncQueue syncQueue) {
    public void clearAllBackoffsLocked(SyncQueue syncQueue) {
        boolean changed = false;
        synchronized (mAuthorities) {
            synchronized (syncQueue) {
                // Clear backoff for all sync adapters.
                for (AccountInfo accountInfo : mAccounts.values()) {
                    for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
                        if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE
                                || authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) {
                            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                                Log.v(TAG, "clearAllBackoffs:"
                                Log.v(TAG, "clearAllBackoffsLocked:"
                                        + " authority:" + authorityInfo.target
                                        + " account:" + accountInfo.accountAndUser.account.name
                                        + " user:" + accountInfo.accountAndUser.userId
@@ -868,7 +867,6 @@ public class SyncStorageEngine extends Handler {
                            authorityInfo.backoffDelay = NOT_IN_BACKOFF_MODE;
                        }
                    }
                }
                syncQueue.clearBackoffs();
            }
        }