diff options
| author | 2018-10-05 02:22:44 -0700 | |
|---|---|---|
| committer | 2018-10-05 02:22:44 -0700 | |
| commit | a44b5f98a9439a36359a187ff2f4946e10c717b1 (patch) | |
| tree | e8972b062d9a706469763e170099bb37568bdb21 | |
| parent | da1171a2901c2b955ffb1294d862acf1ed459bba (diff) | |
| parent | 79822ffb6f9b70e6324bcc577190eb262116c803 (diff) | |
Merge "[PT10] Move loadGlobalProxy into ProxyTracker."
am: 79822ffb6f
Change-Id: If5d2eb35f1c990fc6af5747fb2f8e3d55afb7eb9
| -rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 27 | ||||
| -rw-r--r-- | services/core/java/com/android/server/connectivity/ProxyTracker.java | 29 |
2 files changed, 30 insertions, 26 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 953c99ff2474..5e8ffb79c493 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -1837,7 +1837,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } void systemReady() { - loadGlobalProxy(); + mProxyTracker.loadGlobalProxy(); registerNetdEventCallback(); synchronized (this) { @@ -3455,31 +3455,6 @@ public class ConnectivityService extends IConnectivityManager.Stub mProxyTracker.setGlobalProxy(proxyProperties); } - private void loadGlobalProxy() { - ContentResolver res = mContext.getContentResolver(); - String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST); - int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0); - String exclList = Settings.Global.getString(res, - Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); - String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC); - if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) { - ProxyInfo proxyProperties; - if (!TextUtils.isEmpty(pacFileUrl)) { - proxyProperties = new ProxyInfo(pacFileUrl); - } else { - proxyProperties = new ProxyInfo(host, port, exclList); - } - if (!proxyProperties.isValid()) { - if (DBG) log("Invalid proxy properties, ignoring: " + proxyProperties.toString()); - return; - } - - synchronized (mProxyTracker.mProxyLock) { - mProxyTracker.mGlobalProxy = proxyProperties; - } - } - } - @Override @Nullable public ProxyInfo getGlobalProxy() { diff --git a/services/core/java/com/android/server/connectivity/ProxyTracker.java b/services/core/java/com/android/server/connectivity/ProxyTracker.java index dc65e1e69834..b7bbd422458f 100644 --- a/services/core/java/com/android/server/connectivity/ProxyTracker.java +++ b/services/core/java/com/android/server/connectivity/ProxyTracker.java @@ -142,6 +142,35 @@ public class ProxyTracker { } /** + * Read the global proxy settings and cache them in memory. + */ + public void loadGlobalProxy() { + ContentResolver res = mContext.getContentResolver(); + String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST); + int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0); + String exclList = Settings.Global.getString(res, + Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); + String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC); + if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) { + ProxyInfo proxyProperties; + if (!TextUtils.isEmpty(pacFileUrl)) { + proxyProperties = new ProxyInfo(pacFileUrl); + } else { + proxyProperties = new ProxyInfo(host, port, exclList); + } + if (!proxyProperties.isValid()) { + if (DBG) Slog.d(TAG, "Invalid proxy properties, ignoring: " + proxyProperties); + return; + } + + synchronized (mProxyLock) { + mGlobalProxy = proxyProperties; + } + } + // TODO : shouldn't this function call mPacManager.setCurrentProxyScriptUrl ? + } + + /** * Sends the system broadcast informing apps about a new proxy configuration. * * Confusingly this method also sets the PAC file URL. TODO : separate this, it has nothing |