am 84db79bb: Merge "Clear IP configuration on lost network" into honeycomb-LTE

* commit '84db79bb65bce5c1fd8a6e033cb7e4db4c04f9b1':
  Clear IP configuration on lost network
This commit is contained in:
Irfan Sheriff
2011-06-07 13:44:40 -07:00
committed by Android Git Automerger
2 changed files with 19 additions and 1 deletions

View File

@@ -478,6 +478,21 @@ class WifiConfigStore {
}
}
/**
* clear IP configuration for a given network id
*/
static void clearIpConfiguration(int netId) {
synchronized (sConfiguredNetworks) {
WifiConfiguration config = sConfiguredNetworks.get(netId);
if (config != null && config.linkProperties != null) {
// Clear everything except proxy
ProxyProperties proxy = config.linkProperties.getHttpProxy();
config.linkProperties.clear();
config.linkProperties.setHttpProxy(proxy);
}
}
}
/**
* Fetch the proxy properties for a given network id

View File

@@ -1440,10 +1440,13 @@ public class WifiStateMachine extends StateMachine {
/* Clear network properties */
mLinkProperties.clear();
/* Clear IP settings if the network used DHCP */
if (!WifiConfigStore.isUsingStaticIp(mLastNetworkId)) {
WifiConfigStore.clearIpConfiguration(mLastNetworkId);
}
mLastBssid= null;
mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
}
void handlePreDhcpSetup() {