diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-06-07 12:29:59 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2011-06-07 12:29:59 -0700 |
commit | 0c13d479398ab4d940a302d2efd37cfeee51f872 (patch) | |
tree | 38404b4a8d39d0c0c51f5d17345c43bd9440c608 /wifi/java/android | |
parent | e9d32283e4eca1ee27218ed66f754a694678ac6d (diff) | |
download | frameworks_base-0c13d479398ab4d940a302d2efd37cfeee51f872.zip frameworks_base-0c13d479398ab4d940a302d2efd37cfeee51f872.tar.gz frameworks_base-0c13d479398ab4d940a302d2efd37cfeee51f872.tar.bz2 |
Clear IP configuration on lost network
Bug: 4391449
Change-Id: I574128083a5612f13fcccaf5ed091eae114b7943
Diffstat (limited to 'wifi/java/android')
-rw-r--r-- | wifi/java/android/net/wifi/WifiConfigStore.java | 15 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 5 |
2 files changed, 19 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java index 7f9fc31..d83b968 100644 --- a/wifi/java/android/net/wifi/WifiConfigStore.java +++ b/wifi/java/android/net/wifi/WifiConfigStore.java @@ -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 diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index e03680f..3cbf726 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -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() { |