diff options
author | Subir Jhanb <subir@google.com> | 2011-01-10 12:09:26 -0800 |
---|---|---|
committer | Subir Jhanb <subir@google.com> | 2011-01-10 12:18:11 -0800 |
commit | 753c57bf729def69be3f3ed0bcc07b0d858b73bb (patch) | |
tree | 7312335da2d9d819276deef72014ca53d1387bff /core/java/android/content/SyncManager.java | |
parent | 695172ef273074fa0182133933e6ef15f06fe9cc (diff) | |
download | frameworks_base-753c57bf729def69be3f3ed0bcc07b0d858b73bb.zip frameworks_base-753c57bf729def69be3f3ed0bcc07b0d858b73bb.tar.gz frameworks_base-753c57bf729def69be3f3ed0bcc07b0d858b73bb.tar.bz2 |
Making the sync manager take the data connected value from ConnectivityManager and not from the intent.
BUG: 3337128
BUG: 3334394
Change-Id: I75b88c7cc0be526e8e7e441aa2668307e2452e62
Diffstat (limited to 'core/java/android/content/SyncManager.java')
-rw-r--r-- | core/java/android/content/SyncManager.java | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index 8b292c9..6ac822a 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -237,43 +237,7 @@ public class SyncManager implements OnAccountsUpdateListener { private BroadcastReceiver mConnectivityIntentReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { - NetworkInfo networkInfo = - intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); - NetworkInfo.State state = (networkInfo == null ? NetworkInfo.State.UNKNOWN : - networkInfo.getState()); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "received connectivity action. network info: " + networkInfo); - } - - final boolean wasConnected = mDataConnectionIsConnected; - // only pay attention to the CONNECTED and DISCONNECTED states. - // if connected, we are connected. - // if disconnected, we may not be connected. in some cases, we may be connected on - // a different network. - // e.g., if switching from GPRS to WiFi, we may receive the CONNECTED to WiFi and - // 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 - // since we still have a WiFi connection. - switch (state) { - case CONNECTED: - mDataConnectionIsConnected = true; - break; - case DISCONNECTED: - mDataConnectionIsConnected = !intent.getBooleanExtra( - ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); - break; - default: - // ignore the rest of the states -- leave our boolean alone. - } - if (mDataConnectionIsConnected) { - if (!wasConnected) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "Reconnection detected: clearing all backoffs"); - } - mSyncStorageEngine.clearAllBackoffs(); - } - sendCheckAlarmsMessage(); - } + sendCheckAlarmsMessage(); } }; @@ -1409,6 +1373,11 @@ public class SyncManager implements OnAccountsUpdateListener { public void handleMessage(Message msg) { long earliestFuturePollTime = Long.MAX_VALUE; long nextPendingSyncTime = Long.MAX_VALUE; + + // Setting the value here instead of a method because we want the dumpsys logs + // to have the most recent value used. + mDataConnectionIsConnected = + getConnectivityManager().getActiveNetworkInfo().isConnected(); try { waitUntilReadyToRun(); mSyncManagerWakeLock.acquire(); |