summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/SyncManager.java
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2010-02-18 10:32:54 -0800
committerFred Quintana <fredq@google.com>2010-02-18 17:34:33 -0800
commit8570f7440780db5c9b410e033e843b0e80e2fd27 (patch)
treeec0bb72f30926b6c3857ce4fd949d2f25a13490b /core/java/android/content/SyncManager.java
parentfb6a5359e4ae8d36bcba601aa4ce81dbeb287617 (diff)
downloadframeworks_base-8570f7440780db5c9b410e033e843b0e80e2fd27.zip
frameworks_base-8570f7440780db5c9b410e033e843b0e80e2fd27.tar.gz
frameworks_base-8570f7440780db5c9b410e033e843b0e80e2fd27.tar.bz2
- fix the AccountManager documentation. http://b/2401790
- only pass the authtoken through from the authenticator to the client for getAuthToken() and strip it out from the other calls, like addAccount(). http://b/2332762 - beef up the documentation to indicate what calls are allowed to be made from the main thread and which are not allowed. http://b/2384961 - wait a bit before retrying syncs that failed because one was already in progress. http://b/2414235
Diffstat (limited to 'core/java/android/content/SyncManager.java')
-rw-r--r--core/java/android/content/SyncManager.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 4ddb819..317e5a9 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -115,6 +115,11 @@ public class SyncManager implements OnAccountsUpdateListener {
private static final long DEFAULT_MAX_SYNC_RETRY_TIME_IN_SECONDS = 60 * 60; // one hour
/**
+ * How long to wait before retrying a sync that failed due to one already being in progress.
+ */
+ private static final int DELAY_RETRY_SYNC_IN_PROGRESS_IN_SECONDS = 10;
+
+ /**
* An error notification is sent if sync of any of the providers has been failing for this long.
*/
private static final long ERROR_NOTIFICATION_DELAY_MS = 1000 * 60 * 10; // 10 minutes
@@ -807,6 +812,14 @@ public class SyncManager implements OnAccountsUpdateListener {
+ "it achieved some success");
}
scheduleSyncOperation(operation);
+ } else if (syncResult.syncAlreadyInProgress) {
+ if (isLoggable) {
+ Log.d(TAG, "retrying sync operation that failed because there was already a "
+ + "sync in progress: " + operation);
+ }
+ scheduleSyncOperation(new SyncOperation(operation.account, operation.syncSource,
+ operation.authority, operation.extras,
+ DELAY_RETRY_SYNC_IN_PROGRESS_IN_SECONDS));
} else if (syncResult.hasSoftError()) {
if (isLoggable) {
Log.d(TAG, "retrying sync operation because it encountered a soft error: "