Enhance http proxy support

Make it read proxys the correct way from CS so it works for all network types.
Add utility class for apache http client support.

bug:2700664
Change-Id: If81917b19b5f0636247a6519a1ec78bd8dbf3596
This commit is contained in:
Robert Greenwalt
2010-09-14 09:18:02 -07:00
parent 978f509cea
commit 9f0ee4fcde
3 changed files with 55 additions and 0 deletions

View File

@@ -463,6 +463,38 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return result;
}
/**
* Return LinkProperties for the active (i.e., connected) default
* network interface. It is assumed that at most one default network
* is active at a time. If more than one is active, it is indeterminate
* which will be returned.
* @return the ip properties for the active network, or {@code null} if
* none is active
*/
public LinkProperties getActiveLinkProperties() {
enforceAccessPermission();
for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
if (mNetAttributes[type] == null || !mNetAttributes[type].isDefault()) {
continue;
}
NetworkStateTracker t = mNetTrackers[type];
NetworkInfo info = t.getNetworkInfo();
if (info.isConnected()) {
return t.getLinkProperties();
}
}
return null;
}
public LinkProperties getLinkProperties(int networkType) {
enforceAccessPermission();
if (ConnectivityManager.isNetworkTypeValid(networkType)) {
NetworkStateTracker t = mNetTrackers[networkType];
if (t != null) return t.getLinkProperties();
}
return null;
}
public boolean setRadios(boolean turnOn) {
boolean result = true;
enforceChangePermission();