Load persisted global proxy settings.

Was persisted before, but not loaded at boot.

Change-Id: I6d6b69ede3d212a8266847d73d07a037ae917788
This commit is contained in:
Robert Greenwalt
2010-12-02 11:31:00 -08:00
parent c3c5f865a3
commit 6f7c609039

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();
} }
@@ -2089,7 +2091,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
ContentResolver res = mContext.getContentResolver(); ContentResolver res = mContext.getContentResolver();
Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, host); Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, host);
Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, port); Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, port);
Settings.Secure.putString(res,Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclList); exclList);
} }
@@ -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;