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

Commit ad823421 authored by Paul Jensen's avatar Paul Jensen
Browse files

Deprecate EXTRA_PROXY_INFO and unhide ConnectivityManager.getDefaultProxy().

1. Unhide ConnectivityManager.getDefaultProxy() and update it to
   take into account process-bound-Networks.
2. Deprecate EXTRA_PROXY_INFO and instead encourage querying via
   getDefaultProxy().

Bug: 17905627
Bug: 17420465
Bug: 18144582

Change-Id: I45358ee82fe705d048022c8238b2452f52c37b88
parent 1d52ab69
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16960,6 +16960,7 @@ package android.net {
    method public android.net.Network[] getAllNetworks();
    method public deprecated boolean getBackgroundDataSetting();
    method public android.net.Network getBoundNetworkForProcess();
    method public android.net.ProxyInfo getDefaultProxy();
    method public android.net.LinkProperties getLinkProperties(android.net.Network);
    method public android.net.NetworkCapabilities getNetworkCapabilities(android.net.Network);
    method public android.net.NetworkInfo getNetworkInfo(int);
@@ -17255,7 +17256,7 @@ package android.net {
    method public static final deprecated int getDefaultPort();
    method public static final deprecated java.lang.String getHost(android.content.Context);
    method public static final deprecated int getPort(android.content.Context);
    field public static final java.lang.String EXTRA_PROXY_INFO = "android.intent.extra.PROXY_INFO";
    field public static final deprecated java.lang.String EXTRA_PROXY_INFO = "android.intent.extra.PROXY_INFO";
    field public static final java.lang.String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE";
  }
+2 −1
Original line number Diff line number Diff line
@@ -18221,6 +18221,7 @@ package android.net {
    method public android.net.Network[] getAllNetworks();
    method public deprecated boolean getBackgroundDataSetting();
    method public android.net.Network getBoundNetworkForProcess();
    method public android.net.ProxyInfo getDefaultProxy();
    method public android.net.LinkProperties getLinkProperties(android.net.Network);
    method public android.net.NetworkCapabilities getNetworkCapabilities(android.net.Network);
    method public android.net.NetworkInfo getNetworkInfo(int);
@@ -18541,7 +18542,7 @@ package android.net {
    method public static final deprecated int getDefaultPort();
    method public static final deprecated java.lang.String getHost(android.content.Context);
    method public static final deprecated int getPort(android.content.Context);
    field public static final java.lang.String EXTRA_PROXY_INFO = "android.intent.extra.PROXY_INFO";
    field public static final deprecated java.lang.String EXTRA_PROXY_INFO = "android.intent.extra.PROXY_INFO";
    field public static final java.lang.String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE";
  }
+0 −1
Original line number Diff line number Diff line
@@ -1783,7 +1783,6 @@ public class ConnectivityManager {
     *
     * @return the {@link ProxyInfo} for the current HTTP proxy, or {@code null} if no
     *        HTTP proxy is active.
     * @hide
     */
    public ProxyInfo getDefaultProxy() {
        final Network network = getBoundNetworkForProcess();
+8 −8
Original line number Diff line number Diff line
@@ -44,14 +44,9 @@ public final class Proxy {
    private static final ProxySelector sDefaultProxySelector;

    /**
     * Used to notify an app that's caching the default connection proxy
     * that either the default connection or its proxy has changed.
     * The intent will have the following extra value:</p>
     * <ul>
     *   <li><em>EXTRA_PROXY_INFO</em> - The ProxyProperties for the proxy.  Non-null,
     *                                   though if the proxy is undefined the host string
     *                                   will be empty.
     * </ul>
     * Used to notify an app that's caching the proxy that either the default
     * connection has changed or any connection's proxy has changed. The new
     * proxy should be queried using {@link ConnectivityManager#getDefaultProxy()}.
     *
     * <p class="note">This is a protected intent that can only be sent by the system
     */
@@ -60,6 +55,11 @@ public final class Proxy {
    /**
     * Intent extra included with {@link #PROXY_CHANGE_ACTION} intents.
     * It describes the new proxy being used (as a {@link ProxyInfo} object).
     * @deprecated Because {@code PROXY_CHANGE_ACTION} is sent whenever the proxy
     * for any network on the system changes, applications should always use
     * {@link ConnectivityManager#getDefaultProxy()} or
     * {@link ConnectivityManager#getLinkProperties(Network)}.{@link LinkProperties#getHttpProxy()}
     * to get the proxy for the Network(s) they are using.
     */
    public static final String EXTRA_PROXY_INFO = "android.intent.extra.PROXY_INFO";