From 434203a277cd2f237a71508a3d5a7d1602126cd5 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Mon, 11 Oct 2010 16:00:27 -0700 Subject: Notify all VMs when proxy changes. bug:2700664 Change-Id: I74cc6e0bd6e66847bf18f524ce851e3e9d2c4e87 --- wifi/java/android/net/wifi/WifiConfigStore.java | 47 +++++-------------------- 1 file changed, 8 insertions(+), 39 deletions(-) (limited to 'wifi/java/android/net') diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java index 04b3891..24f6f31 100644 --- a/wifi/java/android/net/wifi/WifiConfigStore.java +++ b/wifi/java/android/net/wifi/WifiConfigStore.java @@ -595,9 +595,9 @@ class WifiConfigStore { out.writeUTF(PROXY_SETTINGS_KEY); out.writeUTF(config.proxySettings.toString()); out.writeUTF(PROXY_HOST_KEY); - out.writeUTF(proxyProperties.getSocketAddress().getHostName()); + out.writeUTF(proxyProperties.getHost()); out.writeUTF(PROXY_PORT_KEY); - out.writeInt(proxyProperties.getSocketAddress().getPort()); + out.writeInt(proxyProperties.getPort()); out.writeUTF(EXCLUSION_LIST_KEY); out.writeUTF(exclusionList); writeToFile = true; @@ -716,10 +716,8 @@ class WifiConfigStore { switch (proxySettings) { case STATIC: config.proxySettings = proxySettings; - ProxyProperties proxyProperties = new ProxyProperties(); - proxyProperties.setSocketAddress( - new InetSocketAddress(proxyHost, proxyPort)); - proxyProperties.setExclusionList(exclusionList); + ProxyProperties proxyProperties = + new ProxyProperties(proxyHost, proxyPort, exclusionList); linkProperties.setHttpProxy(proxyProperties); break; case NONE: @@ -1012,42 +1010,13 @@ class WifiConfigStore { switch (newConfig.proxySettings) { case STATIC: - InetSocketAddress newSockAddr = null; - String newExclusionList = null; - InetSocketAddress currentSockAddr = null; - String currentExclusionList = null; - ProxyProperties newHttpProxy = newConfig.linkProperties.getHttpProxy(); - if (newHttpProxy != null) { - newSockAddr = newHttpProxy.getSocketAddress(); - newExclusionList = newHttpProxy.getExclusionList(); - } - ProxyProperties currentHttpProxy = currentConfig.linkProperties.getHttpProxy(); - if (currentHttpProxy != null) { - currentSockAddr = currentHttpProxy.getSocketAddress(); - currentExclusionList = currentHttpProxy.getExclusionList(); - } - - boolean socketAddressDiffers = false; - boolean exclusionListDiffers = false; - if (newSockAddr != null && currentSockAddr != null ) { - socketAddressDiffers = !currentSockAddr.equals(newSockAddr); - } else if (newSockAddr != null || currentSockAddr != null) { - socketAddressDiffers = true; - } - - if (newExclusionList != null && currentExclusionList != null) { - exclusionListDiffers = !currentExclusionList.equals(newExclusionList); - } else if (newExclusionList != null || currentExclusionList != null) { - exclusionListDiffers = true; - } - - if ((currentConfig.proxySettings != newConfig.proxySettings) || - socketAddressDiffers || - exclusionListDiffers) { - proxyChanged = true; + if (newHttpProxy != null) { + proxyChanged = !newHttpProxy.equals(currentHttpProxy); + } else { + proxyChanged = (currentHttpProxy != null); } break; case NONE: -- cgit v1.1