Load persisted global proxy settings. am: 6f7c609039

Original change: undetermined

Change-Id: I68142d07b9fe9ec7c221eb790a3e18f48169a221
This commit is contained in:
Robert Greenwalt
2021-05-31 10:57:52 +00:00
committed by Automerger Merge Worker

View File

@@ -430,6 +430,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mSettingsObserver = new SettingsObserver(mHandler, EVENT_APPLY_GLOBAL_HTTP_PROXY); mSettingsObserver = new SettingsObserver(mHandler, EVENT_APPLY_GLOBAL_HTTP_PROXY);
mSettingsObserver.observe(mContext); mSettingsObserver.observe(mContext);
loadGlobalProxy();
} }
@@ -2099,6 +2101,20 @@ public class ConnectivityService extends IConnectivityManager.Stub {
sendProxyBroadcast(proxyProperties); sendProxyBroadcast(proxyProperties);
} }
private void loadGlobalProxy() {
ContentResolver res = mContext.getContentResolver();
String host = Settings.Secure.getString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST);
int port = Settings.Secure.getInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, 0);
String exclList = Settings.Secure.getString(res,
Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
if (!TextUtils.isEmpty(host)) {
ProxyProperties proxyProperties = new ProxyProperties(host, port, exclList);
synchronized (mGlobalProxyLock) {
mGlobalProxy = proxyProperties;
}
}
}
public ProxyProperties getGlobalProxy() { public ProxyProperties getGlobalProxy() {
synchronized (mGlobalProxyLock) { synchronized (mGlobalProxyLock) {
return mGlobalProxy; return mGlobalProxy;