diff options
Diffstat (limited to 'wifi/java/android/net')
| -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 | 91 |
3 files changed, 45 insertions, 63 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..a447c86 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.lastIndexOf("SSID="); + if (index != -1) SSID = dataString.substring(index + 5); 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 cc0df52..2f14098 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -669,6 +669,7 @@ public class WifiStateMachine extends StateMachine { setInitialState(mInitialState); + setProcessedMessagesSize(100); if (DBG) setDbg(true); //start the state machine @@ -1121,6 +1122,37 @@ public class WifiStateMachine extends StateMachine { return sb.toString(); } + @Override + protected boolean recordProcessedMessage(Message msg) { + //Ignore screen on/off & common messages when driver has started + if (getCurrentState() == mConnectedState || getCurrentState() == mDisconnectedState) { + switch (msg.what) { + case CMD_LOAD_DRIVER: + case CMD_START_SUPPLICANT: + case CMD_START_DRIVER: + case CMD_SET_SCAN_MODE: + case CMD_SET_HIGH_PERF_MODE: + case CMD_SET_SUSPEND_OPTIMIZATIONS: + case CMD_CLEAR_SUSPEND_OPTIMIZATIONS: + case CMD_ENABLE_BACKGROUND_SCAN: + case CMD_ENABLE_ALL_NETWORKS: + return false; + } + } + + switch (msg.what) { + case CMD_START_SCAN: + case CMD_ENABLE_RSSI_POLL: + case CMD_RSSI_POLL: + case CMD_DELAYED_STOP_DRIVER: + case WifiMonitor.SCAN_RESULTS_EVENT: + case WifiWatchdogStateMachine.RSSI_FETCH: + return false; + default: + return true; + } + } + /********************************************************* * Internal private functions ********************************************************/ @@ -1409,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 */ @@ -1586,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)); @@ -2015,7 +2031,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2068,7 +2083,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2148,7 +2162,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2169,7 +2182,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2250,7 +2262,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2274,7 +2285,6 @@ public class WifiStateMachine extends StateMachine { public boolean processMessage(Message message) { if (DBG) log(getName() + message.toString() + "\n"); WifiConfiguration config; - boolean eventLoggingEnabled = true; switch(message.what) { case CMD_STOP_SUPPLICANT: /* Supplicant stopped by user */ transitionTo(mSupplicantStoppingState); @@ -2291,7 +2301,6 @@ public class WifiStateMachine extends StateMachine { sendMessageDelayed(CMD_START_SUPPLICANT, SUPPLICANT_RESTART_INTERVAL_MSECS); break; case WifiMonitor.SCAN_RESULTS_EVENT: - eventLoggingEnabled = false; setScanResults(mWifiNative.scanResults()); sendScanResultsAvailableBroadcast(); mScanResultIsPending = false; @@ -2381,9 +2390,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - if (eventLoggingEnabled) { - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); - } return HANDLED; } @@ -2459,7 +2465,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2505,7 +2510,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2564,14 +2568,12 @@ public class WifiStateMachine extends StateMachine { @Override public boolean processMessage(Message message) { if (DBG) log(getName() + message.toString() + "\n"); - boolean eventLoggingEnabled = true; switch(message.what) { case CMD_SET_SCAN_TYPE: mSetScanActive = (message.arg1 == SCAN_ACTIVE); mWifiNative.setScanMode(mSetScanActive); break; case CMD_START_SCAN: - eventLoggingEnabled = false; boolean forceActive = (message.arg1 == SCAN_ACTIVE); if (forceActive && !mSetScanActive) { mWifiNative.setScanMode(forceActive); @@ -2681,9 +2683,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - if (eventLoggingEnabled) { - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); - } return HANDLED; } @Override @@ -2731,7 +2730,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2764,7 +2762,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2801,7 +2798,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2923,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 */ @@ -2940,7 +2934,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -2959,7 +2952,6 @@ public class WifiStateMachine extends StateMachine { @Override public boolean processMessage(Message message) { if (DBG) log(getName() + message.toString() + "\n"); - boolean eventLoggingEnabled = true; switch (message.what) { case DhcpStateMachine.CMD_PRE_DHCP_ACTION: handlePreDhcpSetup(); @@ -2988,7 +2980,6 @@ public class WifiStateMachine extends StateMachine { } break; case CMD_START_SCAN: - eventLoggingEnabled = false; /* When the network is connected, re-scanning can trigger * a reconnection. Put it in scan-only mode during scan. * When scan results are received, the mode is switched @@ -3031,7 +3022,6 @@ public class WifiStateMachine extends StateMachine { case WifiMonitor.NETWORK_CONNECTION_EVENT: break; case CMD_RSSI_POLL: - eventLoggingEnabled = false; if (message.arg1 == mRssiPollToken) { // Get Info and continue polling fetchRssiAndLinkSpeedNative(); @@ -3052,7 +3042,6 @@ public class WifiStateMachine extends StateMachine { } break; case WifiWatchdogStateMachine.RSSI_FETCH: - eventLoggingEnabled = false; fetchRssiAndLinkSpeedNative(); replyToMessage(message, WifiWatchdogStateMachine.RSSI_FETCH_SUCCEEDED, mWifiInfo.getRssi()); @@ -3061,9 +3050,6 @@ public class WifiStateMachine extends StateMachine { return NOT_HANDLED; } - if (eventLoggingEnabled) { - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); - } return HANDLED; } @@ -3131,7 +3117,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3168,7 +3153,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3202,7 +3186,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } @Override @@ -3240,7 +3223,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3343,7 +3325,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } @@ -3432,7 +3413,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } @@ -3504,7 +3484,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3548,7 +3527,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3598,7 +3576,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3629,7 +3606,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } @@ -3692,7 +3668,6 @@ public class WifiStateMachine extends StateMachine { default: return NOT_HANDLED; } - EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } } |
