summaryrefslogtreecommitdiffstats
path: root/wifi/java/android/net/wifi/WifiInfo.java
diff options
context:
space:
mode:
authorIsaac Levy <ilevy@google.com>2011-07-07 09:17:29 -0700
committerIsaac Levy <ilevy@google.com>2011-07-19 16:39:34 -0700
commit3550ac919c492f3fbaebbf868f4df0d1ea7ee784 (patch)
tree6444a2dfe6f7a6c5aeab5318744d34c3b26c061b /wifi/java/android/net/wifi/WifiInfo.java
parent6461c97331e9e672e2abd6a46eaaa7b948974484 (diff)
downloadframeworks_base-3550ac919c492f3fbaebbf868f4df0d1ea7ee784.zip
frameworks_base-3550ac919c492f3fbaebbf868f4df0d1ea7ee784.tar.gz
frameworks_base-3550ac919c492f3fbaebbf868f4df0d1ea7ee784.tar.bz2
Adding WifiInfo object in CONNECTED broadcast
Adding a parsable wifiinfo object in Connected broadcast, public api. The connected broadcast only occurs on successful setup on the wifi interface, so in normal use is very infrequent (once if the wifi sleeps, or once at new hotspots, etc...) WifiInfo objects are small, <10 ints, <5 short strings, and contain info that could be useful to listeners, such as SSID. The alternative is to the poll the Wifi Manager, using getConnectionInfo. Because the Wifi Manager can update state in its own thread, polling the Wifi Manager might result in an info object that's out of sync from the received broadcast. Change-Id: Iafcec77f45dd094ea84e6022b7a40e8952ae8137
Diffstat (limited to 'wifi/java/android/net/wifi/WifiInfo.java')
-rw-r--r--wifi/java/android/net/wifi/WifiInfo.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index e3661bf..7bb927b 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -81,6 +81,24 @@ public class WifiInfo implements Parcelable {
mHiddenSSID = false;
}
+ /**
+ * Copy constructor
+ * @hide
+ */
+ public WifiInfo(WifiInfo source) {
+ if (source != null) {
+ mSupplicantState = source.mSupplicantState;
+ mBSSID = source.mBSSID;
+ mSSID = source.mSSID;
+ mNetworkId = source.mNetworkId;
+ mHiddenSSID = source.mHiddenSSID;
+ mRssi = source.mRssi;
+ mLinkSpeed = source.mLinkSpeed;
+ mIpAddress = source.mIpAddress;
+ mMacAddress = source.mMacAddress;
+ }
+ }
+
void setSSID(String SSID) {
mSSID = SSID;
// network is considered not hidden by default