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

Commit 207900c2 authored by Jason Monk's avatar Jason Monk
Browse files

Make proxy API public

Also exposed proxy-related functions that were on the
ConnectivityManager.

Change-Id: I9fb5f1bcc257a6198679ea1d56e18da2ec5a3b33
parent 627aad9c
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -15492,6 +15492,7 @@ package android.net {
    method public android.net.NetworkInfo getActiveNetworkInfo();
    method public android.net.NetworkInfo[] getAllNetworkInfo();
    method public deprecated boolean getBackgroundDataSetting();
    method public android.net.ProxyInfo getGlobalProxy();
    method public android.net.NetworkInfo getNetworkInfo(int);
    method public int getNetworkPreference();
    method public boolean isActiveNetworkMetered();
@@ -15499,6 +15500,7 @@ package android.net {
    method public static boolean isNetworkTypeValid(int);
    method public void registerNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
    method public boolean requestRouteToHost(int, int);
    method public void setGlobalProxy(android.net.ProxyInfo);
    method public void setNetworkPreference(int);
    method public int startUsingNetworkFeature(int, java.lang.String);
    method public int stopUsingNetworkFeature(int, java.lang.String);
@@ -15674,9 +15676,22 @@ 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 java.lang.String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE";
  }
  public class ProxyInfo implements android.os.Parcelable {
    method public static android.net.ProxyInfo buildDirectProxy(java.lang.String, int);
    method public static android.net.ProxyInfo buildDirectProxy(java.lang.String, int, java.util.List<java.lang.String>);
    method public static android.net.ProxyInfo buildPacProxy(android.net.Uri);
    method public int describeContents();
    method public java.lang.String[] getExclusionList();
    method public java.lang.String getHost();
    method public android.net.Uri getPacFileUrl();
    method public int getPort();
    method public void writeToParcel(android.os.Parcel, int);
  }
  public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
    ctor public deprecated SSLCertificateSocketFactory(int);
    method public java.net.Socket createSocket(java.net.Socket, java.lang.String, int, boolean) throws java.io.IOException;
+3 −3
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ import android.graphics.Canvas;
import android.hardware.display.DisplayManagerGlobal;
import android.net.IConnectivityManager;
import android.net.Proxy;
import android.net.ProxyProperties;
import android.net.ProxyInfo;
import android.opengl.GLUtils;
import android.os.AsyncTask;
import android.os.Binder;
@@ -4326,8 +4326,8 @@ public final class ActivityThread {
            // crash if we can't get it.
            IConnectivityManager service = IConnectivityManager.Stub.asInterface(b);
            try {
                ProxyProperties proxyProperties = service.getProxy();
                Proxy.setHttpProxySystemProperty(proxyProperties);
                ProxyInfo proxyInfo = service.getProxy();
                Proxy.setHttpProxySystemProperty(proxyInfo);
            } catch (RemoteException e) {}
        }

+6 −8
Original line number Diff line number Diff line
@@ -1307,14 +1307,13 @@ public class ConnectivityManager {
     * doing something unusual like general internal filtering this may be useful.  On
     * a private network where the proxy is not accessible, you may break HTTP using this.
     *
     * @param p The a {@link ProxyProperties} object defining the new global
     * @param p The a {@link ProxyInfo} object defining the new global
     *        HTTP proxy.  A {@code null} value will clear the global HTTP proxy.
     *
     * <p>This method requires the call to hold the permission
     * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}.
     * {@hide}
     */
    public void setGlobalProxy(ProxyProperties p) {
    public void setGlobalProxy(ProxyInfo p) {
        try {
            mService.setGlobalProxy(p);
        } catch (RemoteException e) {
@@ -1324,14 +1323,13 @@ public class ConnectivityManager {
    /**
     * Retrieve any network-independent global HTTP proxy.
     *
     * @return {@link ProxyProperties} for the current global HTTP proxy or {@code null}
     * @return {@link ProxyInfo} for the current global HTTP proxy or {@code null}
     *        if no global HTTP proxy is set.
     *
     * <p>This method requires the call to hold the permission
     * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
     * {@hide}
     */
    public ProxyProperties getGlobalProxy() {
    public ProxyInfo getGlobalProxy() {
        try {
            return mService.getGlobalProxy();
        } catch (RemoteException e) {
@@ -1343,14 +1341,14 @@ public class ConnectivityManager {
     * Get the HTTP proxy settings for the current default network.  Note that
     * if a global proxy is set, it will override any per-network setting.
     *
     * @return the {@link ProxyProperties} for the current HTTP proxy, or {@code null} if no
     * @return the {@link ProxyInfo} for the current HTTP proxy, or {@code null} if no
     *        HTTP proxy is active.
     *
     * <p>This method requires the call to hold the permission
     * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
     * {@hide}
     */
    public ProxyProperties getProxy() {
    public ProxyInfo getProxy() {
        try {
            return mService.getProxy();
        } catch (RemoteException e) {
+4 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.net.LinkProperties;
import android.net.NetworkInfo;
import android.net.NetworkQuotaInfo;
import android.net.NetworkState;
import android.net.ProxyProperties;
import android.net.ProxyInfo;
import android.os.IBinder;
import android.os.Messenger;
import android.os.ParcelFileDescriptor;
@@ -107,11 +107,11 @@ interface IConnectivityManager

    void reportInetCondition(int networkType, int percentage);

    ProxyProperties getGlobalProxy();
    ProxyInfo getGlobalProxy();

    void setGlobalProxy(in ProxyProperties p);
    void setGlobalProxy(in ProxyInfo p);

    ProxyProperties getProxy();
    ProxyInfo getProxy();

    void setDataDependency(int networkType, boolean met);

+6 −6
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package android.net;

import android.net.ProxyProperties;
import android.net.ProxyInfo;
import android.os.Parcelable;
import android.os.Parcel;
import android.text.TextUtils;
@@ -65,7 +65,7 @@ public class LinkProperties implements Parcelable {
    private ArrayList<InetAddress> mDnses = new ArrayList<InetAddress>();
    private String mDomains;
    private ArrayList<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
    private ProxyProperties mHttpProxy;
    private ProxyInfo mHttpProxy;
    private int mMtu;

    // Stores the properties of links that are "stacked" above this link.
@@ -101,7 +101,7 @@ public class LinkProperties implements Parcelable {
            mDomains = source.getDomains();
            for (RouteInfo r : source.getRoutes()) mRoutes.add(r);
            mHttpProxy = (source.getHttpProxy() == null)  ?
                    null : new ProxyProperties(source.getHttpProxy());
                    null : new ProxyInfo(source.getHttpProxy());
            for (LinkProperties l: source.mStackedLinks.values()) {
                addStackedLink(l);
            }
@@ -295,10 +295,10 @@ public class LinkProperties implements Parcelable {
        return routes;
    }

    public void setHttpProxy(ProxyProperties proxy) {
    public void setHttpProxy(ProxyInfo proxy) {
        mHttpProxy = proxy;
    }
    public ProxyProperties getHttpProxy() {
    public ProxyInfo getHttpProxy() {
        return mHttpProxy;
    }

@@ -720,7 +720,7 @@ public class LinkProperties implements Parcelable {
                    netProp.addRoute((RouteInfo)in.readParcelable(null));
                }
                if (in.readByte() == 1) {
                    netProp.setHttpProxy((ProxyProperties)in.readParcelable(null));
                    netProp.setHttpProxy((ProxyInfo)in.readParcelable(null));
                }
                ArrayList<LinkProperties> stackedLinks = new ArrayList<LinkProperties>();
                in.readList(stackedLinks, LinkProperties.class.getClassLoader());
Loading