diff options
author | Paul Jensen <pauljensen@google.com> | 2014-12-10 15:12:18 -0500 |
---|---|---|
committer | Paul Jensen <pauljensen@google.com> | 2014-12-10 15:22:12 -0500 |
commit | e0bef71662d81caaaa0d7214fb0bef5d39996a69 (patch) | |
tree | c7d7632e475868d3a63f059f44395fd636ca2cf5 /packages/CaptivePortalLogin | |
parent | 8b33cf4d34a9ea75e1121ee2f1d829b21f3cb5d6 (diff) | |
download | frameworks_base-e0bef71662d81caaaa0d7214fb0bef5d39996a69.zip frameworks_base-e0bef71662d81caaaa0d7214fb0bef5d39996a69.tar.gz frameworks_base-e0bef71662d81caaaa0d7214fb0bef5d39996a69.tar.bz2 |
Fix several HTTP proxy issues with multinetworking.
1. Send PROXY_CHANGE_ACTION broadcast when any network's proxy changes,
not just the default network.
2. When a process is bound to a particular Network, update the proxy
system properties to those for the bound Network, and keep them
updated when PROXY_CHANGE_ACTION broadcasts are received.
3. Make Network.openConnection() use the proxy for the Network.
bug:17905627
bug:17420465
bug:18144582
(cherry-pick of https://android-review.googlesource.com/#/c/115170)
Change-Id: Ia2819985e6108a8c121e74c683a5646becfd0a97
Diffstat (limited to 'packages/CaptivePortalLogin')
-rw-r--r-- | packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java index 1c7b033..7253579 100644 --- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java @@ -23,12 +23,10 @@ import android.content.Intent; import android.graphics.Bitmap; import android.net.ConnectivityManager; import android.net.ConnectivityManager.NetworkCallback; -import android.net.LinkProperties; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Proxy; -import android.net.ProxyInfo; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; @@ -96,26 +94,10 @@ public class CaptivePortalLoginActivity extends Activity { done(CAPTIVE_PORTAL_APP_RETURN_WANTED_AS_IS); } + final ConnectivityManager cm = ConnectivityManager.from(this); final Network network = new Network(mNetId); - ConnectivityManager.setProcessDefaultNetwork(network); - - // Set HTTP proxy system properties to those of the selected Network. - final LinkProperties lp = ConnectivityManager.from(this).getLinkProperties(network); - if (lp != null) { - final ProxyInfo proxyInfo = lp.getHttpProxy(); - String host = ""; - String port = ""; - String exclList = ""; - Uri pacFileUrl = Uri.EMPTY; - if (proxyInfo != null) { - host = proxyInfo.getHost(); - port = Integer.toString(proxyInfo.getPort()); - exclList = proxyInfo.getExclusionListAsString(); - pacFileUrl = proxyInfo.getPacFileUrl(); - } - Proxy.setHttpProxySystemProperty(host, port, exclList, pacFileUrl); - Log.v(TAG, "Set proxy system properties to " + proxyInfo); - } + // Also initializes proxy system properties. + cm.setProcessDefaultNetwork(network); // Proxy system properties must be initialized before setContentView is called because // setContentView initializes the WebView logic which in turn reads the system properties. @@ -124,8 +106,7 @@ public class CaptivePortalLoginActivity extends Activity { getActionBar().setDisplayShowHomeEnabled(false); // Exit app if Network disappears. - final NetworkCapabilities networkCapabilities = - ConnectivityManager.from(this).getNetworkCapabilities(network); + final NetworkCapabilities networkCapabilities = cm.getNetworkCapabilities(network); if (networkCapabilities == null) { finish(); return; @@ -140,7 +121,7 @@ public class CaptivePortalLoginActivity extends Activity { for (int transportType : networkCapabilities.getTransportTypes()) { builder.addTransportType(transportType); } - ConnectivityManager.from(this).registerNetworkCallback(builder.build(), mNetworkCallback); + cm.registerNetworkCallback(builder.build(), mNetworkCallback); final WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.clearCache(true); |