summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/SyncQueue.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-10-16 12:02:42 -0700
committerJeff Sharkey <jsharkey@android.com>2012-10-16 13:27:12 -0700
commita706e2fd0059b1bb86c487722dbc9fc0fda9c980 (patch)
tree4588a84b392209055c5c5ec3364bc763377926ef /core/java/android/content/SyncQueue.java
parent4682cf02b42f75876f14f512e874c3e798b09c9c (diff)
downloadframeworks_base-a706e2fd0059b1bb86c487722dbc9fc0fda9c980.zip
frameworks_base-a706e2fd0059b1bb86c487722dbc9fc0fda9c980.tar.gz
frameworks_base-a706e2fd0059b1bb86c487722dbc9fc0fda9c980.tar.bz2
Lock SyncQueue when user starting, copy RSC list.
Document SyncQueue locking policy and protect in onUserStarting() and clearAllBackoffs(). Return copy of ServiceInfo list from RegisteredServicesCache instead of exposing locking externally. Bug: 7357776, 7352537 Change-Id: I6a32ca98a355b639d4207a88bde572179beae359
Diffstat (limited to 'core/java/android/content/SyncQueue.java')
-rw-r--r--core/java/android/content/SyncQueue.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/content/SyncQueue.java b/core/java/android/content/SyncQueue.java
index 395658c..14bfc5b 100644
--- a/core/java/android/content/SyncQueue.java
+++ b/core/java/android/content/SyncQueue.java
@@ -27,11 +27,14 @@ import android.util.Pair;
import com.google.android.collect.Maps;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
+ * Queue of pending sync operations. Not inherently thread safe, external
+ * callers are responsible for locking.
*
* @hide
*/
@@ -43,7 +46,7 @@ public class SyncQueue {
// A Map of SyncOperations operationKey -> SyncOperation that is designed for
// quick lookup of an enqueued SyncOperation.
- public final HashMap<String, SyncOperation> mOperationsMap = Maps.newHashMap();
+ private final HashMap<String, SyncOperation> mOperationsMap = Maps.newHashMap();
public SyncQueue(SyncStorageEngine syncStorageEngine, final SyncAdaptersCache syncAdapters) {
mSyncStorageEngine = syncStorageEngine;
@@ -198,6 +201,10 @@ public class SyncQueue {
}
}
+ public Collection<SyncOperation> getOperations() {
+ return mOperationsMap.values();
+ }
+
public void dump(StringBuilder sb) {
final long now = SystemClock.elapsedRealtime();
sb.append("SyncQueue: ").append(mOperationsMap.size()).append(" operation(s)\n");