diff options
author | Roshan Pius <rpius@google.com> | 2016-03-22 10:31:03 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2016-03-22 11:28:34 -0700 |
commit | cc018db319baff34c9d36928d04c2c420257498f (patch) | |
tree | fbdd9f1e894fb5dae3c3dd14b766dac57b7af0c6 /service | |
parent | 1cba41b5c3a5d96f3f10596afef6159caaff97e4 (diff) |
WifiConfigManager: Write ipconfig.txt for new configs
We need to write the ipconfig.txt file for all new config additions.
The |writeIpAndProxyConfigurationsOnChange| method is modified to force
update the ipconfig.txt for new networks.
While there,
1. Move the log indicating that we're updating ipconfig.txt to the place
where we actually update the file.
2. Remove the redundant config change update broadcast from
|writeIpAndProxyConfigurationsOnChange|. This is anyway being done in
saveNetwork & addOrUpdateNetwork.
BUG: 27697450
Change-Id: Ie2b8d51ed218ac8809a726ca169f2e61ef185593
TEST: Verified that the ipconfig.txt is written for new configs.
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 60abbca7e..b371bdd9a 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -2251,7 +2251,8 @@ public class WifiConfigManager { mConfiguredNetworks.put(currentConfig); - NetworkUpdateResult result = writeIpAndProxyConfigurationsOnChange(currentConfig, config); + NetworkUpdateResult result = + writeIpAndProxyConfigurationsOnChange(currentConfig, config, newNetwork); result.setIsNewNetwork(newNetwork); result.setNetworkId(netId); @@ -2850,16 +2851,11 @@ public class WifiConfigManager { /* Compare current and new configuration and write to file on change */ private NetworkUpdateResult writeIpAndProxyConfigurationsOnChange( WifiConfiguration currentConfig, - WifiConfiguration newConfig) { + WifiConfiguration newConfig, + boolean isNewNetwork) { boolean ipChanged = false; boolean proxyChanged = false; - if (VDBG) { - loge("writeIpAndProxyConfigurationsOnChange: " + currentConfig.SSID + " -> " + - newConfig.SSID + " path: " + ipConfigFile); - } - - switch (newConfig.getIpAssignment()) { case STATIC: if (currentConfig.getIpAssignment() != newConfig.getIpAssignment()) { @@ -2927,10 +2923,12 @@ public class WifiConfigManager { } } - if (ipChanged || proxyChanged) { + if (ipChanged || proxyChanged || isNewNetwork) { + if (VDBG) { + logd("writeIpAndProxyConfigurationsOnChange: " + currentConfig.SSID + " -> " + + newConfig.SSID + " path: " + ipConfigFile); + } writeIpAndProxyConfigurations(); - sendConfiguredNetworksChangedBroadcast(currentConfig, - WifiManager.CHANGE_REASON_CONFIG_CHANGE); } return new NetworkUpdateResult(ipChanged, proxyChanged); } |