From 1fbe9471a63caf10ad32ed569f5a61bd1ff43a91 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Tue, 26 Jan 2016 09:51:41 -0800 Subject: Kill wpa_supplicant before load driver When system_server restarts due to crash, the start sequence for wifi is as follows: 1.) unload wifi driver 2.) load wifi driver 3.) kill wpa_supplicant that was left 4.) start new wpa_supplicant The problem is that when we load the wifi driver, the old wpa_supplicant will be notified immediatedly due to netlink, and tries to bring up the interface This is unnecessary. We should kill wpa_supplicant before loading wifi driver to avoid unnecessary bring up of interface by old wpa_supplicant and possibly race condition in kernel driver. Change-Id: Ie39c9b847d811e09c55386c1c4cf5f554af05868 --- service/java/com/android/server/wifi/WifiStateMachine.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'service/java/com/android') diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index da7a395a9..e02579937 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -6030,6 +6030,12 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno logStateAndMessage(message, getClass().getSimpleName()); switch (message.what) { case CMD_START_SUPPLICANT: + /* Stop a running supplicant after a runtime restart + * Avoids issues with drivers that do not handle interface down + * on a running supplicant properly. + */ + mWifiMonitor.killSupplicant(mP2pSupported); + if (mWifiNative.loadDriver()) { try { mNwService.wifiFirmwareReload(mInterfaceName, "STA"); @@ -6061,12 +6067,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno loge("Unable to change interface settings: " + ie); } - /* Stop a running supplicant after a runtime restart - * Avoids issues with drivers that do not handle interface down - * on a running supplicant properly. - */ - mWifiMonitor.killSupplicant(mP2pSupported); - if (WifiNative.startHal() == false) { /* starting HAL is optional */ loge("Failed to start HAL"); -- cgit v1.2.3