[PT14] No-op refactoring of sendProxyBroadcast

If mGlobalProxy is non-null, then getDefaultProxy returns mGlobalProxy
so the first change is a no-op.
If mGlobalProxy is null and mDefaultProxyEnabled is true, then
getDefaultProxy returns mDefaultProxy, which has just been set to
proxyInfo, so the second change is a no-op.
If mGlobalProxy is null and mDefaultProxyEnabled is true, then
getDefaultProxy returns mDefaultProxy ; if mGlobalProxy is null and
mDefaultProxyEnabled is false, then getDefaultProxy returns null,
therefore the third change is a no-op.

Test: runtest
Change-Id: I7c21062302bf54f4fc917c82e0175975051a55ec
This commit is contained in:
Chalard Jean
2018-06-08 19:39:24 +09:00
parent db2eff0874
commit 1836a63e92

View File

@@ -126,9 +126,9 @@ public class ProxyTracker {
public ProxyInfo getDefaultProxy() {
// This information is already available as a world read/writable jvm property.
synchronized (mProxyLock) {
final ProxyInfo ret = mGlobalProxy;
if ((ret == null) && mDefaultProxyEnabled) return mDefaultProxy;
return ret;
if (mGlobalProxy != null) return mGlobalProxy;
if (mDefaultProxyEnabled) return mDefaultProxy;
return null;
}
}
@@ -296,14 +296,14 @@ public class ProxyTracker {
&& (!Uri.EMPTY.equals(proxyInfo.getPacFileUrl()))
&& proxyInfo.getPacFileUrl().equals(mGlobalProxy.getPacFileUrl())) {
mGlobalProxy = proxyInfo;
sendProxyBroadcast(mGlobalProxy);
sendProxyBroadcast(getDefaultProxy());
return;
}
mDefaultProxy = proxyInfo;
if (mGlobalProxy != null) return;
if (mDefaultProxyEnabled) {
sendProxyBroadcast(proxyInfo);
sendProxyBroadcast(getDefaultProxy());
}
}
}
@@ -320,7 +320,7 @@ public class ProxyTracker {
if (mDefaultProxyEnabled != enabled) {
mDefaultProxyEnabled = enabled;
if (mGlobalProxy == null && mDefaultProxy != null) {
sendProxyBroadcast(enabled ? mDefaultProxy : null);
sendProxyBroadcast(getDefaultProxy());
}
}
}