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

Commit e404dfbf authored by Chalard Jean's avatar Chalard Jean Committed by android-build-merger
Browse files

Merge "[PT10] Move loadGlobalProxy into ProxyTracker." am: 79822ffb am: a44b5f98

am: 8f04e8bc

Change-Id: I593f1987170b279d57e8d18c380c1f16855f9206
parents eff9ffbb 8f04e8bc
Loading
Loading
Loading
Loading
+1 −26
Original line number Original line Diff line number Diff line
@@ -1837,7 +1837,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
    }
    }


    void systemReady() {
    void systemReady() {
        loadGlobalProxy();
        mProxyTracker.loadGlobalProxy();
        registerNetdEventCallback();
        registerNetdEventCallback();


        synchronized (this) {
        synchronized (this) {
@@ -3455,31 +3455,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
        mProxyTracker.setGlobalProxy(proxyProperties);
        mProxyTracker.setGlobalProxy(proxyProperties);
    }
    }


    private void loadGlobalProxy() {
        ContentResolver res = mContext.getContentResolver();
        String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST);
        int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0);
        String exclList = Settings.Global.getString(res,
                Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
        String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC);
        if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) {
            ProxyInfo proxyProperties;
            if (!TextUtils.isEmpty(pacFileUrl)) {
                proxyProperties = new ProxyInfo(pacFileUrl);
            } else {
                proxyProperties = new ProxyInfo(host, port, exclList);
            }
            if (!proxyProperties.isValid()) {
                if (DBG) log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
                return;
            }

            synchronized (mProxyTracker.mProxyLock) {
                mProxyTracker.mGlobalProxy = proxyProperties;
            }
        }
    }

    @Override
    @Override
    @Nullable
    @Nullable
    public ProxyInfo getGlobalProxy() {
    public ProxyInfo getGlobalProxy() {
+29 −0
Original line number Original line Diff line number Diff line
@@ -141,6 +141,35 @@ public class ProxyTracker {
        }
        }
    }
    }


    /**
     * Read the global proxy settings and cache them in memory.
     */
    public void loadGlobalProxy() {
        ContentResolver res = mContext.getContentResolver();
        String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST);
        int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0);
        String exclList = Settings.Global.getString(res,
                Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
        String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC);
        if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) {
            ProxyInfo proxyProperties;
            if (!TextUtils.isEmpty(pacFileUrl)) {
                proxyProperties = new ProxyInfo(pacFileUrl);
            } else {
                proxyProperties = new ProxyInfo(host, port, exclList);
            }
            if (!proxyProperties.isValid()) {
                if (DBG) Slog.d(TAG, "Invalid proxy properties, ignoring: " + proxyProperties);
                return;
            }

            synchronized (mProxyLock) {
                mGlobalProxy = proxyProperties;
            }
        }
        // TODO : shouldn't this function call mPacManager.setCurrentProxyScriptUrl ?
    }

    /**
    /**
     * Sends the system broadcast informing apps about a new proxy configuration.
     * Sends the system broadcast informing apps about a new proxy configuration.
     *
     *