Merge "Make proxy API public"

This commit is contained in:
Jason Monk
2014-05-07 18:54:12 +00:00
committed by Android (Google) Code Review
5 changed files with 161 additions and 89 deletions

View File

@@ -1307,14 +1307,13 @@ public class ConnectivityManager {
* doing something unusual like general internal filtering this may be useful. On * 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. * 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. * HTTP proxy. A {@code null} value will clear the global HTTP proxy.
* *
* <p>This method requires the call to hold the permission * <p>This method requires the call to hold the permission
* {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}. * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}.
* {@hide}
*/ */
public void setGlobalProxy(ProxyProperties p) { public void setGlobalProxy(ProxyInfo p) {
try { try {
mService.setGlobalProxy(p); mService.setGlobalProxy(p);
} catch (RemoteException e) { } catch (RemoteException e) {
@@ -1324,14 +1323,13 @@ public class ConnectivityManager {
/** /**
* Retrieve any network-independent global HTTP proxy. * 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. * if no global HTTP proxy is set.
* *
* <p>This method requires the call to hold the permission * <p>This method requires the call to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
* {@hide}
*/ */
public ProxyProperties getGlobalProxy() { public ProxyInfo getGlobalProxy() {
try { try {
return mService.getGlobalProxy(); return mService.getGlobalProxy();
} catch (RemoteException e) { } catch (RemoteException e) {
@@ -1343,14 +1341,14 @@ public class ConnectivityManager {
* Get the HTTP proxy settings for the current default network. Note that * 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. * 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. * HTTP proxy is active.
* *
* <p>This method requires the call to hold the permission * <p>This method requires the call to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
* {@hide} * {@hide}
*/ */
public ProxyProperties getProxy() { public ProxyInfo getProxy() {
try { try {
return mService.getProxy(); return mService.getProxy();
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@@ -21,7 +21,7 @@ import android.net.LinkProperties;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.NetworkQuotaInfo; import android.net.NetworkQuotaInfo;
import android.net.NetworkState; import android.net.NetworkState;
import android.net.ProxyProperties; import android.net.ProxyInfo;
import android.os.IBinder; import android.os.IBinder;
import android.os.Messenger; import android.os.Messenger;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
@@ -107,11 +107,11 @@ interface IConnectivityManager
void reportInetCondition(int networkType, int percentage); 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); void setDataDependency(int networkType, boolean met);

View File

@@ -16,7 +16,7 @@
package android.net; package android.net;
import android.net.ProxyProperties; import android.net.ProxyInfo;
import android.os.Parcelable; import android.os.Parcelable;
import android.os.Parcel; import android.os.Parcel;
import android.text.TextUtils; import android.text.TextUtils;
@@ -65,7 +65,7 @@ public class LinkProperties implements Parcelable {
private ArrayList<InetAddress> mDnses = new ArrayList<InetAddress>(); private ArrayList<InetAddress> mDnses = new ArrayList<InetAddress>();
private String mDomains; private String mDomains;
private ArrayList<RouteInfo> mRoutes = new ArrayList<RouteInfo>(); private ArrayList<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
private ProxyProperties mHttpProxy; private ProxyInfo mHttpProxy;
private int mMtu; private int mMtu;
// Stores the properties of links that are "stacked" above this link. // Stores the properties of links that are "stacked" above this link.
@@ -101,7 +101,7 @@ public class LinkProperties implements Parcelable {
mDomains = source.getDomains(); mDomains = source.getDomains();
for (RouteInfo r : source.getRoutes()) mRoutes.add(r); for (RouteInfo r : source.getRoutes()) mRoutes.add(r);
mHttpProxy = (source.getHttpProxy() == null) ? mHttpProxy = (source.getHttpProxy() == null) ?
null : new ProxyProperties(source.getHttpProxy()); null : new ProxyInfo(source.getHttpProxy());
for (LinkProperties l: source.mStackedLinks.values()) { for (LinkProperties l: source.mStackedLinks.values()) {
addStackedLink(l); addStackedLink(l);
} }
@@ -295,10 +295,10 @@ public class LinkProperties implements Parcelable {
return routes; return routes;
} }
public void setHttpProxy(ProxyProperties proxy) { public void setHttpProxy(ProxyInfo proxy) {
mHttpProxy = proxy; mHttpProxy = proxy;
} }
public ProxyProperties getHttpProxy() { public ProxyInfo getHttpProxy() {
return mHttpProxy; return mHttpProxy;
} }
@@ -720,7 +720,7 @@ public class LinkProperties implements Parcelable {
netProp.addRoute((RouteInfo)in.readParcelable(null)); netProp.addRoute((RouteInfo)in.readParcelable(null));
} }
if (in.readByte() == 1) { if (in.readByte() == 1) {
netProp.setHttpProxy((ProxyProperties)in.readParcelable(null)); netProp.setHttpProxy((ProxyInfo)in.readParcelable(null));
} }
ArrayList<LinkProperties> stackedLinks = new ArrayList<LinkProperties>(); ArrayList<LinkProperties> stackedLinks = new ArrayList<LinkProperties>();
in.readList(stackedLinks, LinkProperties.class.getClassLoader()); in.readList(stackedLinks, LinkProperties.class.getClassLoader());

View File

@@ -21,14 +21,23 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.text.TextUtils; import android.text.TextUtils;
import org.apache.http.client.HttpClient;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URLConnection;
import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* A container class for the http proxy info * Describes a proxy configuration.
* @hide *
* Proxy configurations are already integrated within the Apache HTTP stack.
* So {@link URLConnection} and {@link HttpClient} will use them automatically.
*
* Other HTTP stacks will need to obtain the proxy info from
* {@link Proxy#PROXY_CHANGE_ACTION} broadcast as the extra {@link Proxy#EXTRA_PROXY_INFO}.
*/ */
public class ProxyProperties implements Parcelable { public class ProxyInfo implements Parcelable {
private String mHost; private String mHost;
private int mPort; private int mPort;
@@ -36,32 +45,82 @@ public class ProxyProperties implements Parcelable {
private String[] mParsedExclusionList; private String[] mParsedExclusionList;
private String mPacFileUrl; private String mPacFileUrl;
/**
*@hide
*/
public static final String LOCAL_EXCL_LIST = ""; public static final String LOCAL_EXCL_LIST = "";
/**
*@hide
*/
public static final int LOCAL_PORT = -1; public static final int LOCAL_PORT = -1;
/**
*@hide
*/
public static final String LOCAL_HOST = "localhost"; public static final String LOCAL_HOST = "localhost";
public ProxyProperties(String host, int port, String exclList) { /**
* Constructs a {@link ProxyInfo} object that points at a Direct proxy
* on the specified host and port.
*/
public static ProxyInfo buildDirectProxy(String host, int port) {
return new ProxyInfo(host, port, null);
}
/**
* Constructs a {@link ProxyInfo} object that points at a Direct proxy
* on the specified host and port.
*
* The proxy will not be used to access any host in exclusion list, exclList.
*
* @param exclList Hosts to exclude using the proxy on connections for. These
* hosts can use wildcards such as *.example.com.
*/
public static ProxyInfo buildDirectProxy(String host, int port, List<String> exclList) {
String[] array = exclList.toArray(new String[exclList.size()]);
return new ProxyInfo(host, port, TextUtils.join(",", array), array);
}
/**
* Construct a {@link ProxyInfo} that will download and run the PAC script
* at the specified URL.
*/
public static ProxyInfo buildPacProxy(Uri pacUri) {
return new ProxyInfo(pacUri.toString());
}
/**
* Create a ProxyProperties that points at a HTTP Proxy.
* @hide
*/
public ProxyInfo(String host, int port, String exclList) {
mHost = host; mHost = host;
mPort = port; mPort = port;
setExclusionList(exclList); setExclusionList(exclList);
} }
public ProxyProperties(String pacFileUrl) { /**
* Create a ProxyProperties that points at a PAC URL.
* @hide
*/
public ProxyInfo(String pacFileUrl) {
mHost = LOCAL_HOST; mHost = LOCAL_HOST;
mPort = LOCAL_PORT; mPort = LOCAL_PORT;
setExclusionList(LOCAL_EXCL_LIST); setExclusionList(LOCAL_EXCL_LIST);
mPacFileUrl = pacFileUrl; mPacFileUrl = pacFileUrl;
} }
// Only used in PacManager after Local Proxy is bound. /**
public ProxyProperties(String pacFileUrl, int localProxyPort) { * Only used in PacManager after Local Proxy is bound.
* @hide
*/
public ProxyInfo(String pacFileUrl, int localProxyPort) {
mHost = LOCAL_HOST; mHost = LOCAL_HOST;
mPort = localProxyPort; mPort = localProxyPort;
setExclusionList(LOCAL_EXCL_LIST); setExclusionList(LOCAL_EXCL_LIST);
mPacFileUrl = pacFileUrl; mPacFileUrl = pacFileUrl;
} }
private ProxyProperties(String host, int port, String exclList, String[] parsedExclList) { private ProxyInfo(String host, int port, String exclList, String[] parsedExclList) {
mHost = host; mHost = host;
mPort = port; mPort = port;
mExclusionList = exclList; mExclusionList = exclList;
@@ -70,16 +129,22 @@ public class ProxyProperties implements Parcelable {
} }
// copy constructor instead of clone // copy constructor instead of clone
public ProxyProperties(ProxyProperties source) { /**
* @hide
*/
public ProxyInfo(ProxyInfo source) {
if (source != null) { if (source != null) {
mHost = source.getHost(); mHost = source.getHost();
mPort = source.getPort(); mPort = source.getPort();
mPacFileUrl = source.getPacFileUrl(); mPacFileUrl = source.mPacFileUrl;
mExclusionList = source.getExclusionList(); mExclusionList = source.getExclusionListAsString();
mParsedExclusionList = source.mParsedExclusionList; mParsedExclusionList = source.mParsedExclusionList;
} }
} }
/**
* @hide
*/
public InetSocketAddress getSocketAddress() { public InetSocketAddress getSocketAddress() {
InetSocketAddress inetSocketAddress = null; InetSocketAddress inetSocketAddress = null;
try { try {
@@ -88,20 +153,46 @@ public class ProxyProperties implements Parcelable {
return inetSocketAddress; return inetSocketAddress;
} }
public String getPacFileUrl() { /**
return mPacFileUrl; * Returns the URL of the current PAC script or null if there is
* no PAC script.
*/
public Uri getPacFileUrl() {
if (TextUtils.isEmpty(mPacFileUrl)) {
return null;
}
return Uri.parse(mPacFileUrl);
} }
/**
* When configured to use a Direct Proxy this returns the host
* of the proxy.
*/
public String getHost() { public String getHost() {
return mHost; return mHost;
} }
/**
* When configured to use a Direct Proxy this returns the port
* of the proxy
*/
public int getPort() { public int getPort() {
return mPort; return mPort;
} }
// comma separated /**
public String getExclusionList() { * When configured to use a Direct Proxy this returns the list
* of hosts for which the proxy is ignored.
*/
public String[] getExclusionList() {
return mParsedExclusionList;
}
/**
* comma separated
* @hide
*/
public String getExclusionListAsString() {
return mExclusionList; return mExclusionList;
} }
@@ -111,33 +202,13 @@ public class ProxyProperties implements Parcelable {
if (mExclusionList == null) { if (mExclusionList == null) {
mParsedExclusionList = new String[0]; mParsedExclusionList = new String[0];
} else { } else {
String splitExclusionList[] = exclusionList.toLowerCase(Locale.ROOT).split(","); mParsedExclusionList = exclusionList.toLowerCase(Locale.ROOT).split(",");
mParsedExclusionList = new String[splitExclusionList.length * 2];
for (int i = 0; i < splitExclusionList.length; i++) {
String s = splitExclusionList[i].trim();
if (s.startsWith(".")) s = s.substring(1);
mParsedExclusionList[i*2] = s;
mParsedExclusionList[(i*2)+1] = "." + s;
}
} }
} }
public boolean isExcluded(String url) { /**
if (TextUtils.isEmpty(url) || mParsedExclusionList == null || * @hide
mParsedExclusionList.length == 0) return false; */
Uri u = Uri.parse(url);
String urlDomain = u.getHost();
if (urlDomain == null) return false;
for (int i = 0; i< mParsedExclusionList.length; i+=2) {
if (urlDomain.equals(mParsedExclusionList[i]) ||
urlDomain.endsWith(mParsedExclusionList[i+1])) {
return true;
}
}
return false;
}
public boolean isValid() { public boolean isValid() {
if (!TextUtils.isEmpty(mPacFileUrl)) return true; if (!TextUtils.isEmpty(mPacFileUrl)) return true;
return Proxy.PROXY_VALID == Proxy.validate(mHost == null ? "" : mHost, return Proxy.PROXY_VALID == Proxy.validate(mHost == null ? "" : mHost,
@@ -145,6 +216,9 @@ public class ProxyProperties implements Parcelable {
mExclusionList == null ? "" : mExclusionList); mExclusionList == null ? "" : mExclusionList);
} }
/**
* @hide
*/
public java.net.Proxy makeProxy() { public java.net.Proxy makeProxy() {
java.net.Proxy proxy = java.net.Proxy.NO_PROXY; java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
if (mHost != null) { if (mHost != null) {
@@ -179,17 +253,17 @@ public class ProxyProperties implements Parcelable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (!(o instanceof ProxyProperties)) return false; if (!(o instanceof ProxyInfo)) return false;
ProxyProperties p = (ProxyProperties)o; ProxyInfo p = (ProxyInfo)o;
// If PAC URL is present in either then they must be equal. // If PAC URL is present in either then they must be equal.
// Other parameters will only be for fall back. // Other parameters will only be for fall back.
if (!TextUtils.isEmpty(mPacFileUrl)) { if (!TextUtils.isEmpty(mPacFileUrl)) {
return mPacFileUrl.equals(p.getPacFileUrl()) && mPort == p.mPort; return mPacFileUrl.equals(p.getPacFileUrl()) && mPort == p.mPort;
} }
if (!TextUtils.isEmpty(p.getPacFileUrl())) { if (!TextUtils.isEmpty(p.mPacFileUrl)) {
return false; return false;
} }
if (mExclusionList != null && !mExclusionList.equals(p.getExclusionList())) return false; if (mExclusionList != null && !mExclusionList.equals(p.getExclusionListAsString())) return false;
if (mHost != null && p.getHost() != null && mHost.equals(p.getHost()) == false) { if (mHost != null && p.getHost() != null && mHost.equals(p.getHost()) == false) {
return false; return false;
} }
@@ -245,15 +319,15 @@ public class ProxyProperties implements Parcelable {
* Implement the Parcelable interface. * Implement the Parcelable interface.
* @hide * @hide
*/ */
public static final Creator<ProxyProperties> CREATOR = public static final Creator<ProxyInfo> CREATOR =
new Creator<ProxyProperties>() { new Creator<ProxyInfo>() {
public ProxyProperties createFromParcel(Parcel in) { public ProxyInfo createFromParcel(Parcel in) {
String host = null; String host = null;
int port = 0; int port = 0;
if (in.readByte() != 0) { if (in.readByte() != 0) {
String url = in.readString(); String url = in.readString();
int localPort = in.readInt(); int localPort = in.readInt();
return new ProxyProperties(url, localPort); return new ProxyInfo(url, localPort);
} }
if (in.readByte() != 0) { if (in.readByte() != 0) {
host = in.readString(); host = in.readString();
@@ -261,13 +335,13 @@ public class ProxyProperties implements Parcelable {
} }
String exclList = in.readString(); String exclList = in.readString();
String[] parsedExclList = in.readStringArray(); String[] parsedExclList = in.readStringArray();
ProxyProperties proxyProperties = ProxyInfo proxyProperties =
new ProxyProperties(host, port, exclList, parsedExclList); new ProxyInfo(host, port, exclList, parsedExclList);
return proxyProperties; return proxyProperties;
} }
public ProxyProperties[] newArray(int size) { public ProxyInfo[] newArray(int size) {
return new ProxyProperties[size]; return new ProxyInfo[size];
} }
}; };
} }

View File

@@ -74,7 +74,7 @@ import android.net.NetworkStateTracker;
import android.net.NetworkUtils; import android.net.NetworkUtils;
import android.net.Proxy; import android.net.Proxy;
import android.net.ProxyDataTracker; import android.net.ProxyDataTracker;
import android.net.ProxyProperties; import android.net.ProxyInfo;
import android.net.RouteInfo; import android.net.RouteInfo;
import android.net.SamplingDataTracker; import android.net.SamplingDataTracker;
import android.net.Uri; import android.net.Uri;
@@ -406,12 +406,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private ArrayList mInetLog; private ArrayList mInetLog;
// track the current default http proxy - tell the world if we get a new one (real change) // track the current default http proxy - tell the world if we get a new one (real change)
private ProxyProperties mDefaultProxy = null; private ProxyInfo mDefaultProxy = null;
private Object mProxyLock = new Object(); private Object mProxyLock = new Object();
private boolean mDefaultProxyDisabled = false; private boolean mDefaultProxyDisabled = false;
// track the global proxy. // track the global proxy.
private ProxyProperties mGlobalProxy = null; private ProxyInfo mGlobalProxy = null;
private PacManager mPacManager = null; private PacManager mPacManager = null;
@@ -3192,7 +3192,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
break; break;
} }
case EVENT_PROXY_HAS_CHANGED: { case EVENT_PROXY_HAS_CHANGED: {
handleApplyDefaultProxy((ProxyProperties)msg.obj); handleApplyDefaultProxy((ProxyInfo)msg.obj);
break; break;
} }
} }
@@ -3410,19 +3410,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return; return;
} }
public ProxyProperties getProxy() { public ProxyInfo getProxy() {
// this information is already available as a world read/writable jvm property // this information is already available as a world read/writable jvm property
// so this API change wouldn't have a benifit. It also breaks the passing // so this API change wouldn't have a benifit. It also breaks the passing
// of proxy info to all the JVMs. // of proxy info to all the JVMs.
// enforceAccessPermission(); // enforceAccessPermission();
synchronized (mProxyLock) { synchronized (mProxyLock) {
ProxyProperties ret = mGlobalProxy; ProxyInfo ret = mGlobalProxy;
if ((ret == null) && !mDefaultProxyDisabled) ret = mDefaultProxy; if ((ret == null) && !mDefaultProxyDisabled) ret = mDefaultProxy;
return ret; return ret;
} }
} }
public void setGlobalProxy(ProxyProperties proxyProperties) { public void setGlobalProxy(ProxyInfo proxyProperties) {
enforceConnectivityInternalPermission(); enforceConnectivityInternalPermission();
synchronized (mProxyLock) { synchronized (mProxyLock) {
@@ -3435,18 +3435,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
String exclList = ""; String exclList = "";
String pacFileUrl = ""; String pacFileUrl = "";
if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) || if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) ||
!TextUtils.isEmpty(proxyProperties.getPacFileUrl()))) { (proxyProperties.getPacFileUrl() != null))) {
if (!proxyProperties.isValid()) { if (!proxyProperties.isValid()) {
if (DBG) if (DBG)
log("Invalid proxy properties, ignoring: " + proxyProperties.toString()); log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
return; return;
} }
mGlobalProxy = new ProxyProperties(proxyProperties); mGlobalProxy = new ProxyInfo(proxyProperties);
host = mGlobalProxy.getHost(); host = mGlobalProxy.getHost();
port = mGlobalProxy.getPort(); port = mGlobalProxy.getPort();
exclList = mGlobalProxy.getExclusionList(); exclList = mGlobalProxy.getExclusionListAsString();
if (proxyProperties.getPacFileUrl() != null) { if (proxyProperties.getPacFileUrl() != null) {
pacFileUrl = proxyProperties.getPacFileUrl(); pacFileUrl = proxyProperties.getPacFileUrl().toString();
} }
} else { } else {
mGlobalProxy = null; mGlobalProxy = null;
@@ -3478,11 +3478,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC); String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC);
if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) { if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) {
ProxyProperties proxyProperties; ProxyInfo proxyProperties;
if (!TextUtils.isEmpty(pacFileUrl)) { if (!TextUtils.isEmpty(pacFileUrl)) {
proxyProperties = new ProxyProperties(pacFileUrl); proxyProperties = new ProxyInfo(pacFileUrl);
} else { } else {
proxyProperties = new ProxyProperties(host, port, exclList); proxyProperties = new ProxyInfo(host, port, exclList);
} }
if (!proxyProperties.isValid()) { if (!proxyProperties.isValid()) {
if (DBG) log("Invalid proxy properties, ignoring: " + proxyProperties.toString()); if (DBG) log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
@@ -3495,7 +3495,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
} }
public ProxyProperties getGlobalProxy() { public ProxyInfo getGlobalProxy() {
// this information is already available as a world read/writable jvm property // this information is already available as a world read/writable jvm property
// so this API change wouldn't have a benifit. It also breaks the passing // so this API change wouldn't have a benifit. It also breaks the passing
// of proxy info to all the JVMs. // of proxy info to all the JVMs.
@@ -3505,9 +3505,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
} }
private void handleApplyDefaultProxy(ProxyProperties proxy) { private void handleApplyDefaultProxy(ProxyInfo proxy) {
if (proxy != null && TextUtils.isEmpty(proxy.getHost()) if (proxy != null && TextUtils.isEmpty(proxy.getHost())
&& TextUtils.isEmpty(proxy.getPacFileUrl())) { && (proxy.getPacFileUrl() == null)) {
proxy = null; proxy = null;
} }
synchronized (mProxyLock) { synchronized (mProxyLock) {
@@ -3544,13 +3544,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return; return;
} }
} }
ProxyProperties p = new ProxyProperties(data[0], proxyPort, ""); ProxyInfo p = new ProxyInfo(data[0], proxyPort, "");
setGlobalProxy(p); setGlobalProxy(p);
} }
} }
private void sendProxyBroadcast(ProxyProperties proxy) { private void sendProxyBroadcast(ProxyInfo proxy) {
if (proxy == null) proxy = new ProxyProperties("", 0, ""); if (proxy == null) proxy = new ProxyInfo("", 0, "");
if (mPacManager.setCurrentProxyScriptUrl(proxy)) return; if (mPacManager.setCurrentProxyScriptUrl(proxy)) return;
if (DBG) log("sending Proxy Broadcast for " + proxy); if (DBG) log("sending Proxy Broadcast for " + proxy);
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);