Use formal API for ActivityThread to set proxy
Add getProxyForNetwork to the public API, and use ConnectivityManager
APIs from ActivityThread (instead of hidden APIs) to get/set the proxy
for an app process.
getProxyForNetwork allows clients to find which proxy applies, which can
be a global proxy setting or a per-network proxy.
The default proxy is now initialized with getDefaultProxy instead of
getProxyForNetwork(null); this should not make a difference, as nothing
should have called bindProcessToNetwork at that point yet.
Bug: 174436414
Test: m; device boots
Change-Id: Ifb516194ecde1567cea4b6806946091cdcf2f015
diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java
index 2a0a74e..2716e09 100644
--- a/framework/src/android/net/ConnectivityManager.java
+++ b/framework/src/android/net/ConnectivityManager.java
@@ -4609,7 +4609,7 @@
// Set HTTP proxy system properties to match network.
// TODO: Deprecate this static method and replace it with a non-static version.
try {
- Proxy.setHttpProxySystemProperty(getInstance().getDefaultProxy());
+ Proxy.setHttpProxyConfiguration(getInstance().getDefaultProxy());
} catch (SecurityException e) {
// The process doesn't have ACCESS_NETWORK_STATE, so we can't fetch the proxy.
Log.e(TAG, "Can't set proxy properties", e);