summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHu Wang <huw@codeaurora.org>2015-03-25 10:15:25 +0800
committerAragaoAnderson <andersonaragao@me.com>2015-04-11 21:30:01 -0300
commit3fbc07d7545ae6f1b46fe2b8e04697c4366f2dda (patch)
tree3db878437d04dacf8ba85408af11eb8091eea025
parentdc67a4a6430e0f7dab3dd335ec4b62f51722acc6 (diff)
downloadandroid_frameworks_opt_net_wifi-3fbc07d7545ae6f1b46fe2b8e04697c4366f2dda.tar.gz
android_frameworks_opt_net_wifi-3fbc07d7545ae6f1b46fe2b8e04697c4366f2dda.tar.bz2
android_frameworks_opt_net_wifi-3fbc07d7545ae6f1b46fe2b8e04697c4366f2dda.zip
Wifi: Exit the monitor thread when killSupplicant is issued.
When Wifi is turned off, WifiStateMachine issues terminate command to the supplicant and waits for the event CTRL-EVENT-TERMINATING. On receiving this TERMINTING event, WifiMonitor stops further monitoring of events. In some instances, WifiMonitor fails to receive the event CTRL-EVENT-TERMINATING and subsequently when Wifi framework times out it kills the supplicant. But this recovery logic has an issue where even though the supplicant is killed, the monitor thread is not stopped from listening the events and WifiMonitor continues looking for the events. Since at the time of killing the supplicant monitor_conn is initialized to NULL, internally fabricated WPA_EVENT_TERMINATING event is issued by the framework. This again leads to the deinitialization of the wlan0 / p2p0 interfaces while the process of initialization is in progress. This leads to concurrent actions of supplicant connection closure and command execution on the control socket. But wpa control interface library is not designed to concurrently handle activities on the control and monitor sockets. To solve this issue, exit the monitor thread when Wifi framework kills the supplicant explicitly (mConnected is set to FALSE). Change-Id: Ie130cb1b089bb39c30c088c6bee71debf7ecb08e CRs-Fixed: 810355
-rwxr-xr-xservice/java/com/android/server/wifi/WifiMonitor.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiMonitor.java b/service/java/com/android/server/wifi/WifiMonitor.java
index 7ececb9e5..9d7780ca8 100755
--- a/service/java/com/android/server/wifi/WifiMonitor.java
+++ b/service/java/com/android/server/wifi/WifiMonitor.java
@@ -686,7 +686,7 @@ public class WifiMonitor {
return false;
} else {
if (DBG) Log.d(TAG, "Dropping event because (" + iface + ") is stopped");
- return true;
+ return false;
}
} else {
if (DBG) Log.d(TAG, "Sending to all monitors because there's no matching iface");
@@ -732,6 +732,11 @@ public class WifiMonitor {
public void run() {
//noinspection InfiniteLoopStatement
for (;;) {
+ if (!mWifiMonitorSingleton.mConnected) {
+ Log.d(TAG, "MonitorThread exit because mConnected is false");
+ break;
+ }
+
String eventStr = mWifiNative.waitForEvent();
// Skip logging the common but mostly uninteresting scan-results event