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

Commit 67dd0a3c authored by Steve Kondik's avatar Steve Kondik
Browse files

Add setting to only use proxy on wifi.

parent f7b82ac4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -89,6 +89,16 @@ final public class Proxy {
        return getDefaultPort();
    }

    /**
     * @param ctx
     * @return if we should only proxy while on wifi
     * @hide
     */
    static final public boolean isProxyForWifiOnly(Context ctx) {
        return Settings.Secure.getInt(ctx.getContentResolver(),
                Settings.Secure.HTTP_PROXY_WIFI_ONLY, 1) != 0;
    }
    
    /**
     * Return the default proxy host specified by the carrier.
     * @return String containing the host name or null if there is no proxy for
+2 −1
Original line number Diff line number Diff line
@@ -261,7 +261,8 @@ public class RequestQueue implements RequestFeeder {
        NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
        String host = Proxy.getHost(mContext);
        if (HttpLog.LOGV) HttpLog.v("RequestQueue.setProxyConfig " + host);
        if (host == null) {
        if (host == null || (Proxy.isProxyForWifiOnly(mContext) &&
                (info == null || info.getType() != ConnectivityManager.TYPE_WIFI))) {
            mProxyHost = null;
        } else {
            mActivePool.disablePersistence();
+6 −0
Original line number Diff line number Diff line
@@ -2092,6 +2092,12 @@ public final class Settings {
         */
        public static final String HTTP_PROXY = "http_proxy";

        /**
         * If proxy should be active on wifi only
         * @hide
         */
        public static final String HTTP_PROXY_WIFI_ONLY = "http_proxy_wifi_only";
        
        /**
         * Whether the package installer should allow installation of apps downloaded from
         * sources other than the Android Market (vending machine).