diff options
| author | Robert Greenwalt <rgreenwalt@google.com> | 2010-09-14 09:18:02 -0700 |
|---|---|---|
| committer | Robert Greenwalt <rgreenwalt@google.com> | 2010-09-17 16:14:10 -0700 |
| commit | d192dad69e9e5a820c5c11d8cd34460c9cc2ed11 (patch) | |
| tree | c73984b5acaa497fa30f207ba2ed5fff8cdb8e9b /services/java/com/android/server/ConnectivityService.java | |
| parent | aca11c0cf401147a075f72f110e0e27336066127 (diff) | |
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
Diffstat (limited to 'services/java/com/android/server/ConnectivityService.java')
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 6935e9296130..315bb876128f 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -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(); |
