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