summaryrefslogtreecommitdiffstats
path: root/wifi/java
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2010-09-16 16:36:42 -0700
committerWink Saville <wink@google.com>2010-09-16 21:26:59 -0700
commitf61101f6266be243c481d163b95e65d67b8d1669 (patch)
treef5320ff97ffda18c94767d6cd747798faf62ab84 /wifi/java
parenta977120681904ee6309f3e90f51c6cc43615c007 (diff)
downloadframeworks_base-f61101f6266be243c481d163b95e65d67b8d1669.zip
frameworks_base-f61101f6266be243c481d163b95e65d67b8d1669.tar.gz
frameworks_base-f61101f6266be243c481d163b95e65d67b8d1669.tar.bz2
Add LinkCapabilities
Change-Id: Ia1599ade936b79f12526252c0a2e6b453abb136e
Diffstat (limited to 'wifi/java')
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java9
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java24
2 files changed, 31 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 26ed878..4435110 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -307,6 +307,7 @@ public class WifiManager {
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String CONFIG_CHANGED_ACTION = "android.net.wifi.CONFIG_CHANGED";
+
/**
* The lookup key for a {@link android.net.LinkProperties} object associated with the
* Wi-Fi network. Retrieve with
@@ -316,6 +317,14 @@ public class WifiManager {
public static final String EXTRA_LINK_PROPERTIES = "linkProperties";
/**
+ * The lookup key for a {@link android.net.LinkCapabilities} object associated with the
+ * Wi-Fi network. Retrieve with
+ * {@link android.content.Intent#getParcelableExtra(String)}.
+ * @hide
+ */
+ public static final String EXTRA_LINK_CAPABILITIES = "linkCapabilities";
+
+ /**
* The network IDs of the configured networks could have changed.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 9cc44b5..f8c9bd6 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
+import android.net.LinkCapabilities;
import android.net.NetworkInfo;
import android.net.LinkProperties;
import android.net.NetworkStateTracker;
@@ -48,6 +49,7 @@ public class WifiStateTracker implements NetworkStateTracker {
private AtomicBoolean mDefaultRouteSet = new AtomicBoolean(false);
private LinkProperties mLinkProperties;
+ private LinkCapabilities mLinkCapabilities;
private NetworkInfo mNetworkInfo;
/* For sending events to connectivity service handler */
@@ -59,9 +61,9 @@ public class WifiStateTracker implements NetworkStateTracker {
public WifiStateTracker() {
mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_WIFI, 0, NETWORKTYPE, "");
mLinkProperties = new LinkProperties();
+ mLinkCapabilities = new LinkCapabilities();
mNetworkInfo.setIsAvailable(false);
- mLinkProperties.clear();
setTeardownRequested(false);
}
@@ -196,6 +198,16 @@ public class WifiStateTracker implements NetworkStateTracker {
}
/**
+ * A capability is an Integer/String pair, the capabilities
+ * are defined in the class LinkSocket#Key.
+ *
+ * @return a copy of this connections capabilities, may be empty but never null.
+ */
+ public LinkCapabilities getLinkCapabilities() {
+ return new LinkCapabilities(mLinkCapabilities);
+ }
+
+ /**
* Fetch default gateway address for the network
*/
public int getDefaultGatewayAddr() {
@@ -230,8 +242,16 @@ public class WifiStateTracker implements NetworkStateTracker {
if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
mNetworkInfo = (NetworkInfo) intent.getParcelableExtra(
WifiManager.EXTRA_NETWORK_INFO);
- mLinkProperties = (LinkProperties) intent.getParcelableExtra(
+ mLinkProperties = intent.getParcelableExtra(
WifiManager.EXTRA_LINK_PROPERTIES);
+ if (mLinkProperties == null) {
+ mLinkProperties = new LinkProperties();
+ }
+ mLinkCapabilities = intent.getParcelableExtra(
+ WifiManager.EXTRA_LINK_CAPABILITIES);
+ if (mLinkCapabilities == null) {
+ mLinkCapabilities = new LinkCapabilities();
+ }
Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
msg.sendToTarget();
} else if (intent.getAction().equals(WifiManager.CONFIG_CHANGED_ACTION)) {