diff options
-rw-r--r-- | wifi/java/android/net/wifi/StateChangeResult.java | 5 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiMonitor.java | 12 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 20 |
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 */ |