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:
@@ -264,6 +264,24 @@ public class ConnectivityManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public LinkProperties getActiveLinkProperties() {
|
||||||
|
try {
|
||||||
|
return mService.getActiveLinkProperties();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public LinkProperties getLinkProperties(int networkType) {
|
||||||
|
try {
|
||||||
|
return mService.getLinkProperties(networkType);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public boolean setRadios(boolean turnOn) {
|
public boolean setRadios(boolean turnOn) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
|
import android.net.LinkProperties;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
@@ -36,6 +37,10 @@ interface IConnectivityManager
|
|||||||
|
|
||||||
NetworkInfo[] getAllNetworkInfo();
|
NetworkInfo[] getAllNetworkInfo();
|
||||||
|
|
||||||
|
LinkProperties getActiveLinkProperties();
|
||||||
|
|
||||||
|
LinkProperties getLinkProperties(int networkType);
|
||||||
|
|
||||||
boolean setRadios(boolean onOff);
|
boolean setRadios(boolean onOff);
|
||||||
|
|
||||||
boolean setRadio(int networkType, boolean turnOn);
|
boolean setRadio(int networkType, boolean turnOn);
|
||||||
|
|||||||
@@ -463,6 +463,38 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
return result;
|
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) {
|
public boolean setRadios(boolean turnOn) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
enforceChangePermission();
|
enforceChangePermission();
|
||||||
|
|||||||
Reference in New Issue
Block a user