am be5f82ab: Merge "DO NOT MERGE - Clear backoffs on reconnect" into gingerbread
* commit 'be5f82ab0ddacea3846cfa5aa846d1c97def0318': DO NOT MERGE - Clear backoffs on reconnect
This commit is contained in:
@@ -258,6 +258,7 @@ public class SyncManager implements OnAccountsUpdateListener {
|
|||||||
// DISCONNECTED for GPRS in any order. if we receive the CONNECTED first, and then
|
// DISCONNECTED for GPRS in any order. if we receive the CONNECTED first, and then
|
||||||
// a DISCONNECTED, we want to make sure we set mDataConnectionIsConnected to true
|
// a DISCONNECTED, we want to make sure we set mDataConnectionIsConnected to true
|
||||||
// since we still have a WiFi connection.
|
// since we still have a WiFi connection.
|
||||||
|
final boolean wasConnected = mDataConnectionIsConnected;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case CONNECTED:
|
case CONNECTED:
|
||||||
mDataConnectionIsConnected = true;
|
mDataConnectionIsConnected = true;
|
||||||
@@ -273,6 +274,12 @@ public class SyncManager implements OnAccountsUpdateListener {
|
|||||||
// ignore the rest of the states -- leave our boolean alone.
|
// ignore the rest of the states -- leave our boolean alone.
|
||||||
}
|
}
|
||||||
if (mDataConnectionIsConnected) {
|
if (mDataConnectionIsConnected) {
|
||||||
|
if (!wasConnected) {
|
||||||
|
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||||
|
Log.v(TAG, "Reconnection detected: clearing all backoffs");
|
||||||
|
}
|
||||||
|
mSyncStorageEngine.clearAllBackoffs();
|
||||||
|
}
|
||||||
sendCheckAlarmsMessage();
|
sendCheckAlarmsMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -525,6 +525,32 @@ public class SyncStorageEngine extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearAllBackoffs() {
|
||||||
|
boolean changed = false;
|
||||||
|
synchronized (mAuthorities) {
|
||||||
|
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:"
|
||||||
|
+ " authority:" + authorityInfo.authority
|
||||||
|
+ " account:" + accountInfo.account.name
|
||||||
|
+ " backoffTime was: " + authorityInfo.backoffTime
|
||||||
|
+ " backoffDelay was: " + authorityInfo.backoffDelay);
|
||||||
|
}
|
||||||
|
authorityInfo.backoffTime = NOT_IN_BACKOFF_MODE;
|
||||||
|
authorityInfo.backoffDelay = NOT_IN_BACKOFF_MODE;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);
|
||||||
|
}
|
||||||
|
}
|
||||||
public void setDelayUntilTime(Account account, String providerName, long delayUntil) {
|
public void setDelayUntilTime(Account account, String providerName, long delayUntil) {
|
||||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||||
Log.v(TAG, "setDelayUntil: " + account + ", provider " + providerName
|
Log.v(TAG, "setDelayUntil: " + account + ", provider " + providerName
|
||||||
|
|||||||
Reference in New Issue
Block a user