Merge "Fix: ConnectivityManager is initialized with a wrong context"

am: 4517eacd5d

Change-Id: I0629b33b8cc5e155b4500cc15901985dbf0a31f2
This commit is contained in:
Tetsutoki Shiozawa
2018-05-25 11:01:09 -07:00
committed by android-build-merger

View File

@@ -964,7 +964,8 @@ public final class ActivityThread {
} }
public void setHttpProxy(String host, String port, String exclList, Uri pacFileUrl) { public void setHttpProxy(String host, String port, String exclList, Uri pacFileUrl) {
final ConnectivityManager cm = ConnectivityManager.from(getSystemContext()); final ConnectivityManager cm = ConnectivityManager.from(
getApplication() != null ? getApplication() : getSystemContext());
final Network network = cm.getBoundNetworkForProcess(); final Network network = cm.getBoundNetworkForProcess();
if (network != null) { if (network != null) {
Proxy.setHttpProxySystemProperty(cm.getDefaultProxy()); Proxy.setHttpProxySystemProperty(cm.getDefaultProxy());