summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-04-16 16:36:59 -0700
committerIrfan Sheriff <isheriff@google.com>2012-04-16 16:49:26 -0700
commit7bdcb1eed755a6a326d807474d2c1476b82220b9 (patch)
tree76178ef1f6f898eab558e4fe0bb3d38baa1b75b4 /wifi
parent60792375761c0b2aed11f7f2ccb60c2e59f9fec1 (diff)
downloadframeworks_base-7bdcb1eed755a6a326d807474d2c1476b82220b9.zip
frameworks_base-7bdcb1eed755a6a326d807474d2c1476b82220b9.tar.gz
frameworks_base-7bdcb1eed755a6a326d807474d2c1476b82220b9.tar.bz2
Fix ssid fetch
Change-Id: Iee5ee5f53bea7dea219b41735cd169389ca7e719
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/StateChangeResult.java5
-rw-r--r--wifi/java/android/net/wifi/WifiMonitor.java12
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java20
3 files changed, 13 insertions, 24 deletions
diff --git a/wifi/java/android/net/wifi/StateChangeResult.java b/wifi/java/android/net/wifi/StateChangeResult.java
index 8ab5982..b15c4a6 100644
--- a/wifi/java/android/net/wifi/StateChangeResult.java
+++ b/wifi/java/android/net/wifi/StateChangeResult.java
@@ -23,12 +23,15 @@
* @hide
*/
public class StateChangeResult {
- StateChangeResult(int networkId, String BSSID, SupplicantState state) {
+ StateChangeResult(int networkId, String SSID, String BSSID, SupplicantState state) {
this.state = state;
+ this.SSID = SSID;
this.BSSID = BSSID;
this.networkId = networkId;
}
+
int networkId;
+ String SSID;
String BSSID;
SupplicantState state;
}
diff --git a/wifi/java/android/net/wifi/WifiMonitor.java b/wifi/java/android/net/wifi/WifiMonitor.java
index 3bd03f5..730e833 100644
--- a/wifi/java/android/net/wifi/WifiMonitor.java
+++ b/wifi/java/android/net/wifi/WifiMonitor.java
@@ -637,6 +637,9 @@ public class WifiMonitor {
* id=network-id state=new-state
*/
private void handleSupplicantStateChange(String dataString) {
+ String SSID = null;
+ int index = dataString.indexOf("SSID=");
+ if (index != -1) SSID = dataString.substring(index);
String[] dataTokens = dataString.split(" ");
String BSSID = null;
@@ -657,7 +660,6 @@ public class WifiMonitor {
try {
value = Integer.parseInt(nameValue[1]);
} catch (NumberFormatException e) {
- Log.w(TAG, "STATE-CHANGE non-integer parameter: " + token);
continue;
}
@@ -680,7 +682,7 @@ public class WifiMonitor {
if (newSupplicantState == SupplicantState.INVALID) {
Log.w(TAG, "Invalid supplicant state: " + newState);
}
- notifySupplicantStateChange(networkId, BSSID, newSupplicantState);
+ notifySupplicantStateChange(networkId, SSID, BSSID, newSupplicantState);
}
}
@@ -729,11 +731,13 @@ public class WifiMonitor {
* Send the state machine a notification that the state of the supplicant
* has changed.
* @param networkId the configured network on which the state change occurred
+ * @param SSID network name
+ * @param BSSID network address
* @param newState the new {@code SupplicantState}
*/
- void notifySupplicantStateChange(int networkId, String BSSID, SupplicantState newState) {
+ void notifySupplicantStateChange(int networkId, String SSID, String BSSID, SupplicantState newState) {
mStateMachine.sendMessage(mStateMachine.obtainMessage(SUPPLICANT_STATE_CHANGE_EVENT,
- new StateChangeResult(networkId, BSSID, newState)));
+ new StateChangeResult(networkId, SSID, BSSID, newState)));
}
/**
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index c0c673c..2f14098 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1441,23 +1441,6 @@ public class WifiStateMachine extends StateMachine {
mScanResults = scanList;
}
- private String fetchSSID() {
- String status = mWifiNative.status();
- if (status == null) {
- return null;
- }
- // extract ssid from a series of "name=value"
- String[] lines = status.split("\n");
- for (String line : lines) {
- String[] prop = line.split(" *= *");
- if (prop.length < 2) continue;
- String name = prop[0];
- String value = prop[1];
- if (name.equalsIgnoreCase("ssid")) return value;
- }
- return null;
- }
-
/*
* Fetch RSSI and linkspeed on current connection
*/
@@ -1618,6 +1601,7 @@ public class WifiStateMachine extends StateMachine {
/* BSSID is valid only in ASSOCIATING state */
mWifiInfo.setBSSID(stateChangeResult.BSSID);
}
+ mWifiInfo.setSSID(stateChangeResult.SSID);
mSupplicantStateTracker.sendMessage(Message.obtain(message));
@@ -2935,8 +2919,6 @@ public class WifiStateMachine extends StateMachine {
mLastNetworkId = message.arg1;
mLastBssid = (String) message.obj;
- //TODO: make supplicant modification to push this in events
- mWifiInfo.setSSID(fetchSSID());
mWifiInfo.setBSSID(mLastBssid);
mWifiInfo.setNetworkId(mLastNetworkId);
/* send event to CM & network change broadcast */