diff options
author | Roshan Pius <rpius@google.com> | 2017-04-06 10:32:28 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-04-11 17:26:37 -0700 |
commit | 911facd2a26141efe5f242e11a07a9d84a45749a (patch) | |
tree | 70df34fbc7d303519ca295448adf7bbe8a892a2e | |
parent | 5ed0a08cce018a10dce2b84f7d818e0f12c09f15 (diff) |
SupplicantStaIfaceHal: Change the order of broadcasts
WifiStateMachine has some assumptions on the order of broadcasts
received. It expects the STATE_CHANGE broadcast before
NETWORK_CONNECTION one. This was true in the old socket interface
ordering of events. So, restore that ordering.
This reordering was causing WSM to not set the |meteredHint| and
|ephemeral| flags in WifiInfo.
Bug: 36840555
Test: Unit tests
Change-Id: I26352317f755e114489501c6b7de95c61e06c7d0
-rw-r--r-- | service/java/com/android/server/wifi/SupplicantStaIfaceHal.java | 6 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java index f21c75490..9c9501b3b 100644 --- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java @@ -1841,13 +1841,13 @@ public class SupplicantStaIfaceHal { WifiSsid wifiSsid = WifiSsid.createFromByteArray(NativeUtil.byteArrayFromArrayList(ssid)); String bssidStr = NativeUtil.macAddressFromByteArray(bssid); - mWifiMonitor.broadcastSupplicantStateChangeEvent( - mIfaceName, mFrameworkNetworkId, wifiSsid, bssidStr, newSupplicantState); + mStateIsFourway = (newState == ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE); if (newSupplicantState == SupplicantState.COMPLETED) { mWifiMonitor.broadcastNetworkConnectionEvent( mIfaceName, mFrameworkNetworkId, bssidStr); } - mStateIsFourway = (newState == ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE); + mWifiMonitor.broadcastSupplicantStateChangeEvent( + mIfaceName, mFrameworkNetworkId, wifiSsid, bssidStr, newSupplicantState); } } diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java index f1897c8b2..74bdfa1c2 100644 --- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java @@ -898,6 +898,7 @@ public class SupplicantStaIfaceHalTest { */ @Test public void testStateChangeToCompletedCallback() throws Exception { + InOrder wifiMonitorInOrder = inOrder(mWifiMonitor); executeAndValidateInitializationSequence(); int frameworkNetworkId = 6; executeAndValidateConnectSequence(frameworkNetworkId, false); @@ -908,11 +909,11 @@ public class SupplicantStaIfaceHalTest { NativeUtil.macAddressToByteArray(BSSID), SUPPLICANT_NETWORK_ID, NativeUtil.decodeSsid(SUPPLICANT_SSID)); - verify(mWifiMonitor).broadcastSupplicantStateChangeEvent( + wifiMonitorInOrder.verify(mWifiMonitor).broadcastNetworkConnectionEvent( + eq(WLAN_IFACE_NAME), eq(frameworkNetworkId), eq(BSSID)); + wifiMonitorInOrder.verify(mWifiMonitor).broadcastSupplicantStateChangeEvent( eq(WLAN_IFACE_NAME), eq(frameworkNetworkId), any(WifiSsid.class), eq(BSSID), eq(SupplicantState.COMPLETED)); - verify(mWifiMonitor).broadcastNetworkConnectionEvent( - eq(WLAN_IFACE_NAME), eq(frameworkNetworkId), eq(BSSID)); } /** |