summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/SyncQueue.java
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2010-02-05 15:28:12 -0800
committerFred Quintana <fredq@google.com>2010-02-08 16:54:43 -0800
commit53bd2522ca7767f46646606123b6e2689b811850 (patch)
tree40a43c4d19ee0c6af8443878e3e889307f33652a /core/java/android/content/SyncQueue.java
parent9be54d400d68c735013bc8069fbcb66c3f98c3ee (diff)
downloadframeworks_base-53bd2522ca7767f46646606123b6e2689b811850.zip
frameworks_base-53bd2522ca7767f46646606123b6e2689b811850.tar.gz
frameworks_base-53bd2522ca7767f46646606123b6e2689b811850.tar.bz2
- change the SyncManager to retry MANUAL syncs that encounter a soft error
- make the sync dump handle the case where there are no accounts - fix a bug that caused the SyncManager to burn up CPU in the system process The following was implemented: scheduler offers: - settings to disable sync - retries of certain errors - backoffs want a way to control these when scheduling a sync - "ignore_settings" - "ignore initial backoff" - "manual" : ignore settings, ignore initial backoff - "do not retry" - need to change the default behavior of not retrying manual syncs to retry regardless
Diffstat (limited to 'core/java/android/content/SyncQueue.java')
-rw-r--r--core/java/android/content/SyncQueue.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/java/android/content/SyncQueue.java b/core/java/android/content/SyncQueue.java
index 2eead3a..bb21488 100644
--- a/core/java/android/content/SyncQueue.java
+++ b/core/java/android/content/SyncQueue.java
@@ -113,10 +113,14 @@ public class SyncQueue {
SyncOperation best = null;
long bestRunTime = 0;
for (SyncOperation op : mOperationsMap.values()) {
- long opRunTime = SyncManager.runTimeWithBackoffs(mSyncStorageEngine, op.account,
- op.authority,
- op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false),
- op.earliestRunTime);
+ long opRunTime = op.earliestRunTime;
+ if (!op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF, false)) {
+ Pair<Long, Long> backoff = mSyncStorageEngine.getBackoff(op.account, op.authority);
+ long delayUntil = mSyncStorageEngine.getDelayUntilTime(op.account, op.authority);
+ opRunTime = Math.max(
+ Math.max(opRunTime, delayUntil),
+ backoff != null ? backoff.first : 0);
+ }
// if the expedited state of both ops are the same then compare their runtime.
// Otherwise the candidate is only better than the current best if the candidate
// is expedited.