am 00ca322d: am 5f350512: Merge "Reset connections AFTER we take down the network." into honeycomb-LTE
* commit '00ca322d5d99056b47a74075e2d2c8b464bbdbc1': Reset connections AFTER we take down the network.
This commit is contained in:
@@ -1267,8 +1267,30 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
}
|
||||
intent.putExtra(ConnectivityManager.EXTRA_INET_CONDITION, mDefaultInetConditionPublished);
|
||||
|
||||
// Reset interface if no other connections are using the same interface
|
||||
boolean doReset = true;
|
||||
LinkProperties linkProperties = mNetTrackers[prevNetType].getLinkProperties();
|
||||
if (linkProperties != null) {
|
||||
String oldIface = linkProperties.getInterfaceName();
|
||||
if (TextUtils.isEmpty(oldIface) == false) {
|
||||
for (NetworkStateTracker networkStateTracker : mNetTrackers) {
|
||||
if (networkStateTracker == null) continue;
|
||||
NetworkInfo networkInfo = networkStateTracker.getNetworkInfo();
|
||||
if (networkInfo.isConnected() && networkInfo.getType() != prevNetType) {
|
||||
LinkProperties l = networkStateTracker.getLinkProperties();
|
||||
if (l == null) continue;
|
||||
if (oldIface.equals(l.getInterfaceName())) {
|
||||
doReset = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// do this before we broadcast the change
|
||||
handleConnectivityChange(prevNetType);
|
||||
handleConnectivityChange(prevNetType, doReset);
|
||||
|
||||
sendStickyBroadcast(intent);
|
||||
/*
|
||||
@@ -1490,7 +1512,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
thisNet.setTeardownRequested(false);
|
||||
updateNetworkSettings(thisNet);
|
||||
handleConnectivityChange(type);
|
||||
handleConnectivityChange(type, false);
|
||||
sendConnectedBroadcast(info);
|
||||
}
|
||||
|
||||
@@ -1500,7 +1522,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
* according to which networks are connected, and ensuring that the
|
||||
* right routing table entries exist.
|
||||
*/
|
||||
private void handleConnectivityChange(int netType) {
|
||||
private void handleConnectivityChange(int netType, boolean doReset) {
|
||||
/*
|
||||
* If a non-default network is enabled, add the host routes that
|
||||
* will allow it's DNS servers to be accessed.
|
||||
@@ -1540,6 +1562,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
removePrivateDnsRoutes(mNetTrackers[netType]);
|
||||
}
|
||||
}
|
||||
|
||||
if (doReset) {
|
||||
LinkProperties linkProperties = mNetTrackers[netType].getLinkProperties();
|
||||
if (linkProperties != null) {
|
||||
String iface = linkProperties.getInterfaceName();
|
||||
if (TextUtils.isEmpty(iface) == false) {
|
||||
if (DBG) log("resetConnections(" + iface + ")");
|
||||
NetworkUtils.resetConnections(iface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addPrivateDnsRoutes(NetworkStateTracker nt) {
|
||||
@@ -1965,7 +1998,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
break;
|
||||
case NetworkStateTracker.EVENT_CONFIGURATION_CHANGED:
|
||||
info = (NetworkInfo) msg.obj;
|
||||
handleConnectivityChange(info.getType());
|
||||
handleConnectivityChange(info.getType(), true);
|
||||
break;
|
||||
case EVENT_CLEAR_NET_TRANSITION_WAKELOCK:
|
||||
String causedBy = null;
|
||||
|
||||
Reference in New Issue
Block a user