diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-03-30 09:30:32 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-30 09:30:32 -0700 |
commit | 11ebb6f5020761b9b8373a5e0d777fb91a2b92c2 (patch) | |
tree | e222107253cc5a87791722373ea6d23941cb3b62 /core | |
parent | ce6766ea51a943b9f8908cb18d0d9762497b478c (diff) | |
parent | 05f14e2bcf78be62b35e85902408ea66103a3881 (diff) | |
download | frameworks_base-11ebb6f5020761b9b8373a5e0d777fb91a2b92c2.zip frameworks_base-11ebb6f5020761b9b8373a5e0d777fb91a2b92c2.tar.gz frameworks_base-11ebb6f5020761b9b8373a5e0d777fb91a2b92c2.tar.bz2 |
am 05f14e2b: Merge "DO NOT MERGE Pick upstream intf with valid IP conf" into gingerbread
* commit '05f14e2bcf78be62b35e85902408ea66103a3881':
DO NOT MERGE Pick upstream intf with valid IP conf
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/net/InterfaceConfiguration.java | 18 |
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; |