Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 1 | From 5427620c157f9ef0c6948c31868f273d8ca27b74 Mon Sep 17 00:00:00 2001 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 2 | From: Pierre-Hugues Husson <phh@phh.me> |
| 3 | Date: Wed, 15 Aug 2018 00:04:45 +0200 |
Pierre-Hugues Husson | 5d5d68a | 2018-10-02 16:41:21 +0200 | [diff] [blame] | 4 | Subject: [PATCH 2/3] Start supplicant later |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 5 | |
| 6 | Change-Id: I6a67baad486162415840006711fb6d8dbf96a66a |
| 7 | --- |
Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 8 | .../java/com/android/server/wifi/WifiNative.java | 16 ++++++++++------ |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 9 | 1 file changed, 10 insertions(+), 6 deletions(-) |
| 10 | |
| 11 | diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java |
Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 12 | index bc599c141..eb5e11aca 100644 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 13 | --- a/service/java/com/android/server/wifi/WifiNative.java |
| 14 | +++ b/service/java/com/android/server/wifi/WifiNative.java |
| 15 | @@ -332,13 +332,15 @@ public class WifiNative { |
| 16 | } |
| 17 | |
| 18 | /** Helper method invoked to start supplicant if there were no STA ifaces */ |
| 19 | + private boolean supplicantOn = false; |
| 20 | private boolean startSupplicant() { |
| 21 | synchronized (mLock) { |
| 22 | - if (!mIfaceMgr.hasAnyStaIface()) { |
| 23 | + if (!mIfaceMgr.hasAnyStaIface() || !supplicantOn) { |
| 24 | if (!mWificondControl.enableSupplicant()) { |
| 25 | Log.e(TAG, "Failed to enable supplicant"); |
| 26 | return false; |
| 27 | } |
| 28 | + supplicantOn = true; |
| 29 | if (!waitForSupplicantConnection()) { |
| 30 | Log.e(TAG, "Failed to connect to supplicant"); |
| 31 | return false; |
| 32 | @@ -363,6 +365,7 @@ public class WifiNative { |
| 33 | if (!mWificondControl.disableSupplicant()) { |
| 34 | Log.e(TAG, "Failed to disable supplicant"); |
| 35 | } |
| 36 | + supplicantOn = false; |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | @@ -852,11 +855,6 @@ public class WifiNative { |
| 41 | mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal(); |
| 42 | return null; |
| 43 | } |
| 44 | - if (!startSupplicant()) { |
| 45 | - Log.e(TAG, "Failed to start supplicant"); |
| 46 | - mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant(); |
| 47 | - return null; |
| 48 | - } |
| 49 | Iface iface = mIfaceMgr.allocateIface(Iface.IFACE_TYPE_STA); |
| 50 | if (iface == null) { |
| 51 | Log.e(TAG, "Failed to allocate new STA iface"); |
| 52 | @@ -870,6 +868,12 @@ public class WifiNative { |
| 53 | mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal(); |
| 54 | return null; |
| 55 | } |
| 56 | + Log.e(TAG, "Starting supplicant"); |
| 57 | + if (!startSupplicant()) { |
| 58 | + Log.e(TAG, "Failed to start supplicant"); |
| 59 | + mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant(); |
| 60 | + return null; |
| 61 | + } |
| 62 | if (mWificondControl.setupInterfaceForClientMode(iface.name) == null) { |
| 63 | Log.e(TAG, "Failed to setup iface in wificond on " + iface); |
| 64 | teardownInterface(iface.name); |
| 65 | -- |
Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 66 | 2.17.1 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 67 | |