am ccbe7e6f: Merge "Use CONNECTIVITY_INTERNAL for global proxy" into jb-mr2-dev

* commit 'ccbe7e6ff16fe1afc08f0b8601d83481ba5aee3a':
  Use CONNECTIVITY_INTERNAL for global proxy
This commit is contained in:
Robert Greenwalt
2013-04-11 14:16:28 -07:00
committed by Android Git Automerger
2 changed files with 11 additions and 6 deletions

View File

@@ -1136,7 +1136,7 @@ public class ConnectivityManager {
* HTTP proxy. A {@code null} value will clear the global HTTP proxy. * HTTP proxy. A {@code null} value will clear the global HTTP proxy.
* *
* <p>This method requires the call to hold the permission * <p>This method requires the call to hold the permission
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}. * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}.
* {@hide} * {@hide}
*/ */
public void setGlobalProxy(ProxyProperties p) { public void setGlobalProxy(ProxyProperties p) {

View File

@@ -3045,7 +3045,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
public void setGlobalProxy(ProxyProperties proxyProperties) { public void setGlobalProxy(ProxyProperties proxyProperties) {
enforceChangePermission(); enforceConnectivityInternalPermission();
synchronized (mProxyLock) { synchronized (mProxyLock) {
if (proxyProperties == mGlobalProxy) return; if (proxyProperties == mGlobalProxy) return;
if (proxyProperties != null && proxyProperties.equals(mGlobalProxy)) return; if (proxyProperties != null && proxyProperties.equals(mGlobalProxy)) return;
@@ -3063,10 +3063,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mGlobalProxy = null; mGlobalProxy = null;
} }
ContentResolver res = mContext.getContentResolver(); ContentResolver res = mContext.getContentResolver();
Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, host); final long token = Binder.clearCallingIdentity();
Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, port); try {
Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, host);
exclList); Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, port);
Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclList);
} finally {
Binder.restoreCallingIdentity(token);
}
} }
if (mGlobalProxy == null) { if (mGlobalProxy == null) {