Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19aa80f9 authored by Chalard Jean's avatar Chalard Jean
Browse files

[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
parent 1ad4aed0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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());
                }
            }
        }