Notify all VMs when proxy changes.
bug:2700664
Change-Id: I74cc6e0bd6e66847bf18f524ce851e3e9d2c4e87
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 3cead11..c0714e3 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -42,6 +42,9 @@
import android.database.sqlite.SQLiteDebug.DbStats;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.net.IConnectivityManager;
+import android.net.Proxy;
+import android.net.ProxyProperties;
import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
@@ -272,7 +275,7 @@
super(resultCode, resultData, resultExtras, TYPE_COMPONENT, ordered, sticky, token);
this.intent = intent;
}
-
+
Intent intent;
ActivityInfo info;
public String toString() {
@@ -592,6 +595,10 @@
InetAddress.clearDnsCache();
}
+ public void setHttpProxy(String host, String port, String exclList) {
+ Proxy.setHttpProxySystemProperty(host, port, exclList);
+ }
+
public void processInBackground() {
mH.removeMessages(H.GC_WHEN_IDLE);
mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE));
@@ -3253,6 +3260,16 @@
}
}
+ /**
+ * Initialize the default http proxy in this process for the reasons we set the time zone.
+ */
+ IBinder b = ServiceManager.getService(Context.CONNECTIVITY_SERVICE);
+ IConnectivityManager service = IConnectivityManager.Stub.asInterface(b);
+ try {
+ ProxyProperties proxyProperties = service.getProxy();
+ Proxy.setHttpProxySystemProperty(proxyProperties);
+ } catch (RemoteException e) {}
+
if (data.instrumentationName != null) {
ContextImpl appContext = new ContextImpl();
appContext.init(data.info, null, this);