summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-01-17 12:38:30 -0800
committerIrfan Sheriff <isheriff@google.com>2011-03-25 10:09:55 -0700
commitc0e0dbb45446e5e0f7f131f2180c946778e7d711 (patch)
tree113a0d6b4140a16bda3c5430680c560fd3592209 /core
parentff5a09904fb05f2776f1bbf1dd3915f38031190c (diff)
downloadframeworks_base-c0e0dbb45446e5e0f7f131f2180c946778e7d711.zip
frameworks_base-c0e0dbb45446e5e0f7f131f2180c946778e7d711.tar.gz
frameworks_base-c0e0dbb45446e5e0f7f131f2180c946778e7d711.tar.bz2
DO NOT MERGE Pick upstream intf with valid IP conf
As a work around for the issue of picking the wrong interface, add a check for selecting an upstream interface that has a valid IP configuration Bug: 3362306 Change-Id: I3e8ab5ef30b69f1adab755d83f5b65c078f73936
Diffstat (limited to 'core')
-rw-r--r--core/java/android/net/InterfaceConfiguration.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index 915c5d7..dcea3af 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -51,6 +51,24 @@ public class InterfaceConfiguration implements Parcelable {
append(addr & 0xff);
}
+ /**
+ * This function determines if the interface is up and has a valid IP
+ * configuration (IP address has a non zero octet).
+ *
+ * Note: It is supposed to be quick and hence should not initiate
+ * any network activity
+ */
+ public boolean isActive() {
+ try {
+ if(interfaceFlags.contains("up")) {
+ if (ipAddr != 0) return true;
+ }
+ } catch (NullPointerException e) {
+ return false;
+ }
+ return false;
+ }
+
/** Implement the Parcelable interface {@hide} */
public int describeContents() {
return 0;