Fix a few synchronization issues in WifiMonitor.
- Guard all field accesses in WifiMonitorSingleton with a lock. - WifiMonitorSingleton is now responsible for dispatching events to a given monitor (or all monitors if it can't find a matching monitor). - Individual WifiMonitors are now responsible for dispatching events sent to them. This makes WifiMonitorThread a dumb object. All it does is wait for events and feed them back into the WifiMonitorSingleton. - Also fixes a bug where we weren't telling the WifiMonitor that we're disconnected and another where we don't check whether a monitor is connected or not before asking it to dispatch an event. - Also, replaces a few uses of entrySet() with a values() iterator when the keys are never used. The performance of both methods is identical for a HashMap, but the latter is a bit more concise and easier to read. Change-Id: I7ce00174a78c72836666d25ccc5e6e9e687c2570
Loading
Please register or sign in to comment