Make proxy API public
Also exposed proxy-related functions that were on the ConnectivityManager. Change-Id: I9fb5f1bcc257a6198679ea1d56e18da2ec5a3b33
This commit is contained in:
parent
d48bb67aac
commit
4d5e20f870
5 changed files with 161 additions and 89 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
347
core/java/android/net/ProxyInfo.java
Normal file
347
core/java/android/net/ProxyInfo.java
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net;
|
||||
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Describes a proxy configuration.
|
||||
*
|
||||
* 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 ProxyInfo implements Parcelable {
|
||||
|
||||
private String mHost;
|
||||
private int mPort;
|
||||
private String mExclusionList;
|
||||
private String[] mParsedExclusionList;
|
||||
|
||||
private String mPacFileUrl;
|
||||
/**
|
||||
*@hide
|
||||
*/
|
||||
public static final String LOCAL_EXCL_LIST = "";
|
||||
/**
|
||||
*@hide
|
||||
*/
|
||||
public static final int LOCAL_PORT = -1;
|
||||
/**
|
||||
*@hide
|
||||
*/
|
||||
public static final String LOCAL_HOST = "localhost";
|
||||
|
||||
/**
|
||||
* 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;
|
||||
mPort = port;
|
||||
setExclusionList(exclList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a ProxyProperties that points at a PAC URL.
|
||||
* @hide
|
||||
*/
|
||||
public ProxyInfo(String pacFileUrl) {
|
||||
mHost = LOCAL_HOST;
|
||||
mPort = LOCAL_PORT;
|
||||
setExclusionList(LOCAL_EXCL_LIST);
|
||||
mPacFileUrl = pacFileUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used in PacManager after Local Proxy is bound.
|
||||
* @hide
|
||||
*/
|
||||
public ProxyInfo(String pacFileUrl, int localProxyPort) {
|
||||
mHost = LOCAL_HOST;
|
||||
mPort = localProxyPort;
|
||||
setExclusionList(LOCAL_EXCL_LIST);
|
||||
mPacFileUrl = pacFileUrl;
|
||||
}
|
||||
|
||||
private ProxyInfo(String host, int port, String exclList, String[] parsedExclList) {
|
||||
mHost = host;
|
||||
mPort = port;
|
||||
mExclusionList = exclList;
|
||||
mParsedExclusionList = parsedExclList;
|
||||
mPacFileUrl = null;
|
||||
}
|
||||
|
||||
// copy constructor instead of clone
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public ProxyInfo(ProxyInfo source) {
|
||||
if (source != null) {
|
||||
mHost = source.getHost();
|
||||
mPort = source.getPort();
|
||||
mPacFileUrl = source.mPacFileUrl;
|
||||
mExclusionList = source.getExclusionListAsString();
|
||||
mParsedExclusionList = source.mParsedExclusionList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public InetSocketAddress getSocketAddress() {
|
||||
InetSocketAddress inetSocketAddress = null;
|
||||
try {
|
||||
inetSocketAddress = new InetSocketAddress(mHost, mPort);
|
||||
} catch (IllegalArgumentException e) { }
|
||||
return inetSocketAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
return mHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* When configured to use a Direct Proxy this returns the port
|
||||
* of the proxy
|
||||
*/
|
||||
public int getPort() {
|
||||
return mPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
// comma separated
|
||||
private void setExclusionList(String exclusionList) {
|
||||
mExclusionList = exclusionList;
|
||||
if (mExclusionList == null) {
|
||||
mParsedExclusionList = new String[0];
|
||||
} else {
|
||||
mParsedExclusionList = exclusionList.toLowerCase(Locale.ROOT).split(",");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public boolean isValid() {
|
||||
if (!TextUtils.isEmpty(mPacFileUrl)) return true;
|
||||
return Proxy.PROXY_VALID == Proxy.validate(mHost == null ? "" : mHost,
|
||||
mPort == 0 ? "" : Integer.toString(mPort),
|
||||
mExclusionList == null ? "" : mExclusionList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public java.net.Proxy makeProxy() {
|
||||
java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
|
||||
if (mHost != null) {
|
||||
try {
|
||||
InetSocketAddress inetSocketAddress = new InetSocketAddress(mHost, mPort);
|
||||
proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, inetSocketAddress);
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mPacFileUrl != null) {
|
||||
sb.append("PAC Script: ");
|
||||
sb.append(mPacFileUrl);
|
||||
} else if (mHost != null) {
|
||||
sb.append("[");
|
||||
sb.append(mHost);
|
||||
sb.append("] ");
|
||||
sb.append(Integer.toString(mPort));
|
||||
if (mExclusionList != null) {
|
||||
sb.append(" xl=").append(mExclusionList);
|
||||
}
|
||||
} else {
|
||||
sb.append("[ProxyProperties.mHost == null]");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof ProxyInfo)) return false;
|
||||
ProxyInfo p = (ProxyInfo)o;
|
||||
// If PAC URL is present in either then they must be equal.
|
||||
// Other parameters will only be for fall back.
|
||||
if (!TextUtils.isEmpty(mPacFileUrl)) {
|
||||
return mPacFileUrl.equals(p.getPacFileUrl()) && mPort == p.mPort;
|
||||
}
|
||||
if (!TextUtils.isEmpty(p.mPacFileUrl)) {
|
||||
return false;
|
||||
}
|
||||
if (mExclusionList != null && !mExclusionList.equals(p.getExclusionListAsString())) return false;
|
||||
if (mHost != null && p.getHost() != null && mHost.equals(p.getHost()) == false) {
|
||||
return false;
|
||||
}
|
||||
if (mHost != null && p.mHost == null) return false;
|
||||
if (mHost == null && p.mHost != null) return false;
|
||||
if (mPort != p.mPort) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the Parcelable interface
|
||||
* @hide
|
||||
*/
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*
|
||||
* generate hashcode based on significant fields
|
||||
*/
|
||||
public int hashCode() {
|
||||
return ((null == mHost) ? 0 : mHost.hashCode())
|
||||
+ ((null == mExclusionList) ? 0 : mExclusionList.hashCode())
|
||||
+ mPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the Parcelable interface.
|
||||
* @hide
|
||||
*/
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
if (mPacFileUrl != null) {
|
||||
dest.writeByte((byte)1);
|
||||
dest.writeString(mPacFileUrl);
|
||||
dest.writeInt(mPort);
|
||||
return;
|
||||
} else {
|
||||
dest.writeByte((byte)0);
|
||||
}
|
||||
if (mHost != null) {
|
||||
dest.writeByte((byte)1);
|
||||
dest.writeString(mHost);
|
||||
dest.writeInt(mPort);
|
||||
} else {
|
||||
dest.writeByte((byte)0);
|
||||
}
|
||||
dest.writeString(mExclusionList);
|
||||
dest.writeStringArray(mParsedExclusionList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the Parcelable interface.
|
||||
* @hide
|
||||
*/
|
||||
public static final Creator<ProxyInfo> CREATOR =
|
||||
new Creator<ProxyInfo>() {
|
||||
public ProxyInfo createFromParcel(Parcel in) {
|
||||
String host = null;
|
||||
int port = 0;
|
||||
if (in.readByte() != 0) {
|
||||
String url = in.readString();
|
||||
int localPort = in.readInt();
|
||||
return new ProxyInfo(url, localPort);
|
||||
}
|
||||
if (in.readByte() != 0) {
|
||||
host = in.readString();
|
||||
port = in.readInt();
|
||||
}
|
||||
String exclList = in.readString();
|
||||
String[] parsedExclList = in.readStringArray();
|
||||
ProxyInfo proxyProperties =
|
||||
new ProxyInfo(host, port, exclList, parsedExclList);
|
||||
return proxyProperties;
|
||||
}
|
||||
|
||||
public ProxyInfo[] newArray(int size) {
|
||||
return new ProxyInfo[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ import android.net.NetworkStateTracker;
|
|||
import android.net.NetworkUtils;
|
||||
import android.net.Proxy;
|
||||
import android.net.ProxyDataTracker;
|
||||
import android.net.ProxyProperties;
|
||||
import android.net.ProxyInfo;
|
||||
import android.net.RouteInfo;
|
||||
import android.net.SamplingDataTracker;
|
||||
import android.net.Uri;
|
||||
|
|
@ -406,12 +406,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||
private ArrayList mInetLog;
|
||||
|
||||
// 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 boolean mDefaultProxyDisabled = false;
|
||||
|
||||
// track the global proxy.
|
||||
private ProxyProperties mGlobalProxy = null;
|
||||
private ProxyInfo mGlobalProxy = null;
|
||||
|
||||
private PacManager mPacManager = null;
|
||||
|
||||
|
|
@ -3192,7 +3192,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||
break;
|
||||
}
|
||||
case EVENT_PROXY_HAS_CHANGED: {
|
||||
handleApplyDefaultProxy((ProxyProperties)msg.obj);
|
||||
handleApplyDefaultProxy((ProxyInfo)msg.obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3410,19 +3410,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||
return;
|
||||
}
|
||||
|
||||
public ProxyProperties getProxy() {
|
||||
public ProxyInfo getProxy() {
|
||||
// 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
|
||||
// of proxy info to all the JVMs.
|
||||
// enforceAccessPermission();
|
||||
synchronized (mProxyLock) {
|
||||
ProxyProperties ret = mGlobalProxy;
|
||||
ProxyInfo ret = mGlobalProxy;
|
||||
if ((ret == null) && !mDefaultProxyDisabled) ret = mDefaultProxy;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public void setGlobalProxy(ProxyProperties proxyProperties) {
|
||||
public void setGlobalProxy(ProxyInfo proxyProperties) {
|
||||
enforceConnectivityInternalPermission();
|
||||
|
||||
synchronized (mProxyLock) {
|
||||
|
|
@ -3435,18 +3435,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||
String exclList = "";
|
||||
String pacFileUrl = "";
|
||||
if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) ||
|
||||
!TextUtils.isEmpty(proxyProperties.getPacFileUrl()))) {
|
||||
(proxyProperties.getPacFileUrl() != null))) {
|
||||
if (!proxyProperties.isValid()) {
|
||||
if (DBG)
|
||||
log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
|
||||
return;
|
||||
}
|
||||
mGlobalProxy = new ProxyProperties(proxyProperties);
|
||||
mGlobalProxy = new ProxyInfo(proxyProperties);
|
||||
host = mGlobalProxy.getHost();
|
||||
port = mGlobalProxy.getPort();
|
||||
exclList = mGlobalProxy.getExclusionList();
|
||||
exclList = mGlobalProxy.getExclusionListAsString();
|
||||
if (proxyProperties.getPacFileUrl() != null) {
|
||||
pacFileUrl = proxyProperties.getPacFileUrl();
|
||||
pacFileUrl = proxyProperties.getPacFileUrl().toString();
|
||||
}
|
||||
} else {
|
||||
mGlobalProxy = null;
|
||||
|
|
@ -3478,11 +3478,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||
Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
|
||||
String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC);
|
||||
if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) {
|
||||
ProxyProperties proxyProperties;
|
||||
ProxyInfo proxyProperties;
|
||||
if (!TextUtils.isEmpty(pacFileUrl)) {
|
||||
proxyProperties = new ProxyProperties(pacFileUrl);
|
||||
proxyProperties = new ProxyInfo(pacFileUrl);
|
||||
} else {
|
||||
proxyProperties = new ProxyProperties(host, port, exclList);
|
||||
proxyProperties = new ProxyInfo(host, port, exclList);
|
||||
}
|
||||
if (!proxyProperties.isValid()) {
|
||||
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
|
||||
// so this API change wouldn't have a benifit. It also breaks the passing
|
||||
// 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())
|
||||
&& TextUtils.isEmpty(proxy.getPacFileUrl())) {
|
||||
&& (proxy.getPacFileUrl() == null)) {
|
||||
proxy = null;
|
||||
}
|
||||
synchronized (mProxyLock) {
|
||||
|
|
@ -3544,13 +3544,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||
return;
|
||||
}
|
||||
}
|
||||
ProxyProperties p = new ProxyProperties(data[0], proxyPort, "");
|
||||
ProxyInfo p = new ProxyInfo(data[0], proxyPort, "");
|
||||
setGlobalProxy(p);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendProxyBroadcast(ProxyProperties proxy) {
|
||||
if (proxy == null) proxy = new ProxyProperties("", 0, "");
|
||||
private void sendProxyBroadcast(ProxyInfo proxy) {
|
||||
if (proxy == null) proxy = new ProxyInfo("", 0, "");
|
||||
if (mPacManager.setCurrentProxyScriptUrl(proxy)) return;
|
||||
if (DBG) log("sending Proxy Broadcast for " + proxy);
|
||||
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
|
||||
|
|
|
|||
Loading…
Reference in a new issue