Loading core/java/android/net/Proxy.java +10 −0 Original line number Diff line number Diff line Loading @@ -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 Loading core/java/android/net/http/RequestQueue.java +2 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading core/java/android/provider/Settings.java +6 −0 Original line number Diff line number Diff line Loading @@ -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). Loading Loading
core/java/android/net/Proxy.java +10 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/net/http/RequestQueue.java +2 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading
core/java/android/provider/Settings.java +6 −0 Original line number Diff line number Diff line Loading @@ -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). Loading