am 4777fd12: am 3cc68d33: Fix the reporting of NO_CONNECTIVITY.

Merge commit '4777fd12d863a78ef378b322f1929690341946a5'

* commit '4777fd12d863a78ef378b322f1929690341946a5':
  Fix the reporting of NO_CONNECTIVITY.
This commit is contained in:
Robert Greenwalt
2010-01-28 14:46:55 -08:00
committed by Android Git Automerger

View File

@@ -828,12 +828,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
info.getExtraInfo()); info.getExtraInfo());
} }
NetworkStateTracker newNet = tryFailover(prevNetType); NetworkStateTracker newNet = null;
if (newNet != null) { if (mNetAttributes[prevNetType].isDefault()) {
NetworkInfo switchTo = newNet.getNetworkInfo(); newNet = tryFailover(prevNetType);
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo); if (newNet != null) {
} else { NetworkInfo switchTo = newNet.getNetworkInfo();
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true); intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
} else {
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
}
} }
// do this before we broadcast the change // do this before we broadcast the change
handleConnectivityChange(); handleConnectivityChange();
@@ -848,7 +851,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
} }
// returns -1 if no failover available // returns null if no failover available
private NetworkStateTracker tryFailover(int prevNetType) { private NetworkStateTracker tryFailover(int prevNetType) {
/* /*
* If this is a default network, check if other defaults are available * If this is a default network, check if other defaults are available
@@ -970,13 +973,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
info.setFailover(false); info.setFailover(false);
} }
NetworkStateTracker newNet = tryFailover(info.getType()); NetworkStateTracker newNet = null;
if (newNet != null) { if (mNetAttributes[info.getType()].isDefault()) {
NetworkInfo switchTo = newNet.getNetworkInfo(); newNet = tryFailover(info.getType());
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo); if (newNet != null) {
} else { NetworkInfo switchTo = newNet.getNetworkInfo();
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true); intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
} else {
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
}
} }
// do this before we broadcast the change // do this before we broadcast the change
handleConnectivityChange(); handleConnectivityChange();