summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGeoffrey Borggaard <geoffreyb@google.com>2014-11-20 14:35:32 -0500
committerGeoffrey Borggaard <geoffreyb@google.com>2014-11-20 19:48:20 +0000
commit79adc958e5cd8daf7231ec042dfa367010d415f4 (patch)
treeb06813d11359679a8fcc285e00d54632a9f470e4 /services
parentc79173c7da4de4d809d3b5492e5433393193a652 (diff)
downloadframeworks_base-79adc958e5cd8daf7231ec042dfa367010d415f4.zip
frameworks_base-79adc958e5cd8daf7231ec042dfa367010d415f4.tar.gz
frameworks_base-79adc958e5cd8daf7231ec042dfa367010d415f4.tar.bz2
Fix null handling in proxies.
ProxyInfo.getPacFileUrl() can not be null. It will be equal to Uri.EMPTY. Checking for null was causing global proxies to never be disabled. Or more accurately, global proxies would be disabled, but would reappear after a reboot. ProxyInfo.getExclusionListByString() can be null. If no exclusion list was specified, the proxy settings would not be successfully saved, they would disappear after reboot. Bug: 18453223 Change-Id: I1c27e5dca5b9664bb7468ea909bff489fa110a07
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java9
-rw-r--r--services/core/java/com/android/server/net/IpConfigStore.java6
2 files changed, 9 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 6a6dcaf..b4a248f 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2532,7 +2532,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
String exclList = "";
String pacFileUrl = "";
if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) ||
- (proxyProperties.getPacFileUrl() != null))) {
+ !Uri.EMPTY.equals(proxyProperties.getPacFileUrl()))) {
if (!proxyProperties.isValid()) {
if (DBG)
log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
@@ -2542,7 +2542,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
host = mGlobalProxy.getHost();
port = mGlobalProxy.getPort();
exclList = mGlobalProxy.getExclusionListAsString();
- if (proxyProperties.getPacFileUrl() != null) {
+ if (!Uri.EMPTY.equals(proxyProperties.getPacFileUrl())) {
pacFileUrl = proxyProperties.getPacFileUrl().toString();
}
} else {
@@ -2604,7 +2604,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private void handleApplyDefaultProxy(ProxyInfo proxy) {
if (proxy != null && TextUtils.isEmpty(proxy.getHost())
- && (proxy.getPacFileUrl() == null)) {
+ && Uri.EMPTY.equals(proxy.getPacFileUrl())) {
proxy = null;
}
synchronized (mProxyLock) {
@@ -2620,7 +2620,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// global (to get the correct local port), and send a broadcast.
// TODO: Switch PacManager to have its own message to send back rather than
// 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())) {
mGlobalProxy = proxy;
sendProxyBroadcast(mGlobalProxy);
diff --git a/services/core/java/com/android/server/net/IpConfigStore.java b/services/core/java/com/android/server/net/IpConfigStore.java
index 857b9e9..b5a450d 100644
--- a/services/core/java/com/android/server/net/IpConfigStore.java
+++ b/services/core/java/com/android/server/net/IpConfigStore.java
@@ -122,8 +122,10 @@ public class IpConfigStore {
out.writeUTF(proxyProperties.getHost());
out.writeUTF(PROXY_PORT_KEY);
out.writeInt(proxyProperties.getPort());
- out.writeUTF(EXCLUSION_LIST_KEY);
- out.writeUTF(exclusionList);
+ if (exclusionList != null) {
+ out.writeUTF(EXCLUSION_LIST_KEY);
+ out.writeUTF(exclusionList);
+ }
written = true;
break;
case PAC: