am c3f5d718: Merge "Fix null handling in proxies." into lmp-dev

automerge: 90ed95f

* commit '90ed95faeddf7ebe71320e3e0e80eb17d374e49c':
  Fix null handling in proxies.
This commit is contained in:
Geoffrey Borggaard
2014-11-21 10:17:39 +00:00
committed by android-build-merger
2 changed files with 9 additions and 6 deletions

View File

@ -2598,7 +2598,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
String exclList = ""; String exclList = "";
String pacFileUrl = ""; String pacFileUrl = "";
if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) || if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) ||
(proxyProperties.getPacFileUrl() != null))) { !Uri.EMPTY.equals(proxyProperties.getPacFileUrl()))) {
if (!proxyProperties.isValid()) { if (!proxyProperties.isValid()) {
if (DBG) if (DBG)
log("Invalid proxy properties, ignoring: " + proxyProperties.toString()); log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
@ -2608,7 +2608,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
host = mGlobalProxy.getHost(); host = mGlobalProxy.getHost();
port = mGlobalProxy.getPort(); port = mGlobalProxy.getPort();
exclList = mGlobalProxy.getExclusionListAsString(); exclList = mGlobalProxy.getExclusionListAsString();
if (proxyProperties.getPacFileUrl() != null) { if (!Uri.EMPTY.equals(proxyProperties.getPacFileUrl())) {
pacFileUrl = proxyProperties.getPacFileUrl().toString(); pacFileUrl = proxyProperties.getPacFileUrl().toString();
} }
} else { } else {
@ -2670,7 +2670,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void handleApplyDefaultProxy(ProxyInfo proxy) { private void handleApplyDefaultProxy(ProxyInfo proxy) {
if (proxy != null && TextUtils.isEmpty(proxy.getHost()) if (proxy != null && TextUtils.isEmpty(proxy.getHost())
&& (proxy.getPacFileUrl() == null)) { && Uri.EMPTY.equals(proxy.getPacFileUrl())) {
proxy = null; proxy = null;
} }
synchronized (mProxyLock) { synchronized (mProxyLock) {
@ -2686,7 +2686,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
// global (to get the correct local port), and send a broadcast. // global (to get the correct local port), and send a broadcast.
// TODO: Switch PacManager to have its own message to send back rather than // TODO: Switch PacManager to have its own message to send back rather than
// reusing EVENT_HAS_CHANGED_PROXY and this call to handleApplyDefaultProxy. // reusing EVENT_HAS_CHANGED_PROXY and this call to handleApplyDefaultProxy.
if ((mGlobalProxy != null) && (proxy != null) && (proxy.getPacFileUrl() != null) if ((mGlobalProxy != null) && (proxy != null)
&& (!Uri.EMPTY.equals(proxy.getPacFileUrl()))
&& proxy.getPacFileUrl().equals(mGlobalProxy.getPacFileUrl())) { && proxy.getPacFileUrl().equals(mGlobalProxy.getPacFileUrl())) {
mGlobalProxy = proxy; mGlobalProxy = proxy;
sendProxyBroadcast(mGlobalProxy); sendProxyBroadcast(mGlobalProxy);

View File

@ -122,8 +122,10 @@ public class IpConfigStore {
out.writeUTF(proxyProperties.getHost()); out.writeUTF(proxyProperties.getHost());
out.writeUTF(PROXY_PORT_KEY); out.writeUTF(PROXY_PORT_KEY);
out.writeInt(proxyProperties.getPort()); out.writeInt(proxyProperties.getPort());
out.writeUTF(EXCLUSION_LIST_KEY); if (exclusionList != null) {
out.writeUTF(exclusionList); out.writeUTF(EXCLUSION_LIST_KEY);
out.writeUTF(exclusionList);
}
written = true; written = true;
break; break;
case PAC: case PAC: