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
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index b483f6c..dd9c8f0 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -264,6 +264,24 @@
}
}
+ /** @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} */
public boolean setRadios(boolean turnOn) {
try {
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 9f2fc17..35054d6 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -16,6 +16,7 @@
package android.net;
+import android.net.LinkProperties;
import android.net.NetworkInfo;
import android.os.IBinder;
@@ -36,6 +37,10 @@
NetworkInfo[] getAllNetworkInfo();
+ LinkProperties getActiveLinkProperties();
+
+ LinkProperties getLinkProperties(int networkType);
+
boolean setRadios(boolean onOff);
boolean setRadio(int networkType, boolean turnOn);
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 6935e92..315bb87 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -463,6 +463,38 @@
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();