Skip to content

Commit bc156ba

Browse files
mjwilliams43Android (Google) Code Review
authored andcommitted
Merge "Fix deadlock caused by clearAllBackoffs in SSE" into lmp-dev
2 parents d8f7e04 + 119aac9 commit bc156ba

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

services/core/java/com/android/server/content/SyncManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ public void onReceive(Context context, Intent intent) {
311311
if (Log.isLoggable(TAG, Log.VERBOSE)) {
312312
Log.v(TAG, "Reconnection detected: clearing all backoffs");
313313
}
314-
mSyncStorageEngine.clearAllBackoffs(mSyncQueue);
314+
synchronized (mSyncQueue) {
315+
mSyncStorageEngine.clearAllBackoffsLocked(mSyncQueue);
316+
}
315317
}
316318
sendCheckAlarmsMessage();
317319
}

services/core/java/com/android/server/content/SyncStorageEngine.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,17 +834,16 @@ private boolean setBackoffLocked(Account account, int userId, String providerNam
834834
return changed;
835835
}
836836

837-
public void clearAllBackoffs(SyncQueue syncQueue) {
837+
public void clearAllBackoffsLocked(SyncQueue syncQueue) {
838838
boolean changed = false;
839839
synchronized (mAuthorities) {
840-
synchronized (syncQueue) {
841840
// Clear backoff for all sync adapters.
842841
for (AccountInfo accountInfo : mAccounts.values()) {
843842
for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
844843
if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE
845844
|| authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) {
846845
if (Log.isLoggable(TAG, Log.VERBOSE)) {
847-
Log.v(TAG, "clearAllBackoffs:"
846+
Log.v(TAG, "clearAllBackoffsLocked:"
848847
+ " authority:" + authorityInfo.target
849848
+ " account:" + accountInfo.accountAndUser.account.name
850849
+ " user:" + accountInfo.accountAndUser.userId
@@ -868,7 +867,6 @@ public void clearAllBackoffs(SyncQueue syncQueue) {
868867
authorityInfo.backoffDelay = NOT_IN_BACKOFF_MODE;
869868
}
870869
}
871-
}
872870
syncQueue.clearBackoffs();
873871
}
874872
}

0 commit comments

Comments
 (0)