From 49ad9d4f0c52b44dcfce54bc594df902dda3df0c Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Fri, 11 May 2018 10:59:09 -0700 Subject: WifiVendorHal: Change radio mode info parsing logic Change the parsing logic based on clarification from the vendor. Each RadioModeInfo instance represents a single independently controllable hardware MAC at the chip level. So, for the time sharing modes (SCC or MCC), the number of RadioModeInfo instances will be 1 which represents the single active hardware MAC. The previous parsing logic assumed that the time sharing modes will contain 2 RadioModeInfo instances. Bug: 78576621 Test: Modified Unit tests to meet new expectations. Test: Manually verified the mode change callbacks with STA + AP. Change-Id: I207cc1f1ec178eab1b797a5892cd0babe7a344e9 --- .../com/android/server/wifi/WifiVendorHalTest.java | 120 +-------------------- 1 file changed, 3 insertions(+), 117 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index dcef6e9d4..f7a3c4be6 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -2261,8 +2261,6 @@ public class WifiVendorHalTest { RadioModeInfo radioModeInfo0 = new RadioModeInfo(); radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - RadioModeInfo radioModeInfo1 = new RadioModeInfo(); - radioModeInfo1.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; IfaceInfo ifaceInfo0 = new IfaceInfo(); ifaceInfo0.name = TEST_IFACE_NAME; @@ -2273,12 +2271,9 @@ public class WifiVendorHalTest { radioModeInfo0.ifaceInfos.add(ifaceInfo0); radioModeInfo0.ifaceInfos.add(ifaceInfo1); - radioModeInfo1.ifaceInfos.add(ifaceInfo0); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); ArrayList radioModeInfos = new ArrayList<>(); radioModeInfos.add(radioModeInfo0); - radioModeInfos.add(radioModeInfo1); mIWifiChipEventCallbackV12.onRadioModeChange(radioModeInfos); verify(mVendorHalRadioModeChangeHandler).onScc(WifiScanner.WIFI_BAND_5_GHZ); @@ -2294,97 +2289,23 @@ public class WifiVendorHalTest { startHalInStaModeAndRegisterRadioModeChangeCallback(); RadioModeInfo radioModeInfo0 = new RadioModeInfo(); - radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - RadioModeInfo radioModeInfo1 = new RadioModeInfo(); - radioModeInfo1.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; + radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_BOTH; IfaceInfo ifaceInfo0 = new IfaceInfo(); ifaceInfo0.name = TEST_IFACE_NAME; - ifaceInfo0.channel = 34; + ifaceInfo0.channel = 1; IfaceInfo ifaceInfo1 = new IfaceInfo(); ifaceInfo1.name = TEST_IFACE_NAME_1; ifaceInfo1.channel = 36; radioModeInfo0.ifaceInfos.add(ifaceInfo0); radioModeInfo0.ifaceInfos.add(ifaceInfo1); - radioModeInfo1.ifaceInfos.add(ifaceInfo0); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); ArrayList radioModeInfos = new ArrayList<>(); radioModeInfos.add(radioModeInfo0); - radioModeInfos.add(radioModeInfo1); mIWifiChipEventCallbackV12.onRadioModeChange(radioModeInfos); - verify(mVendorHalRadioModeChangeHandler).onMcc(WifiScanner.WIFI_BAND_5_GHZ); - - verifyNoMoreInteractions(mVendorHalRadioModeChangeHandler); - } - - /** - * Verifies radio mode change callback error cases. - */ - @Test - public void testRadioModeChangeCallbackErrorTimeSharingWithDifferentIfacesOnBothRadios() - throws Exception { - startHalInStaModeAndRegisterRadioModeChangeCallback(); - - RadioModeInfo radioModeInfo0 = new RadioModeInfo(); - radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - RadioModeInfo radioModeInfo1 = new RadioModeInfo(); - radioModeInfo1.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - - IfaceInfo ifaceInfo0 = new IfaceInfo(); - ifaceInfo0.name = TEST_IFACE_NAME; - ifaceInfo0.channel = 34; - IfaceInfo ifaceInfo1 = new IfaceInfo(); - ifaceInfo1.name = TEST_IFACE_NAME_1; - ifaceInfo1.channel = 34; - - radioModeInfo0.ifaceInfos.add(ifaceInfo0); - radioModeInfo0.ifaceInfos.add(ifaceInfo0); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); - - ArrayList radioModeInfos = new ArrayList<>(); - radioModeInfos.add(radioModeInfo0); - radioModeInfos.add(radioModeInfo1); - - mIWifiChipEventCallbackV12.onRadioModeChange(radioModeInfos); - // Ignored.... - - verifyNoMoreInteractions(mVendorHalRadioModeChangeHandler); - } - - /** - * Verifies radio mode change callback error cases. - */ - @Test - public void testRadioModeChangeCallbackErrorTimeSharingWithDifferentNumberOfIfacesOnBothRadios() - throws Exception { - startHalInStaModeAndRegisterRadioModeChangeCallback(); - - RadioModeInfo radioModeInfo0 = new RadioModeInfo(); - radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - RadioModeInfo radioModeInfo1 = new RadioModeInfo(); - radioModeInfo1.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - - IfaceInfo ifaceInfo0 = new IfaceInfo(); - ifaceInfo0.name = TEST_IFACE_NAME; - ifaceInfo0.channel = 34; - IfaceInfo ifaceInfo1 = new IfaceInfo(); - ifaceInfo1.name = TEST_IFACE_NAME_1; - ifaceInfo1.channel = 34; - - radioModeInfo0.ifaceInfos.add(ifaceInfo0); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); - - ArrayList radioModeInfos = new ArrayList<>(); - radioModeInfos.add(radioModeInfo0); - radioModeInfos.add(radioModeInfo1); - - mIWifiChipEventCallbackV12.onRadioModeChange(radioModeInfos); - // Ignored.... + verify(mVendorHalRadioModeChangeHandler).onMcc(WifiScanner.WIFI_BAND_BOTH); verifyNoMoreInteractions(mVendorHalRadioModeChangeHandler); } @@ -2419,41 +2340,6 @@ public class WifiVendorHalTest { verifyNoMoreInteractions(mVendorHalRadioModeChangeHandler); } - /** - * Verifies radio mode change callback error cases. - */ - @Test - public void testRadioModeChangeCallbackErrorTimeSharingWithDifferentBandsOnBothRadios() - throws Exception { - startHalInStaModeAndRegisterRadioModeChangeCallback(); - - RadioModeInfo radioModeInfo0 = new RadioModeInfo(); - radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_24_GHZ; - RadioModeInfo radioModeInfo1 = new RadioModeInfo(); - radioModeInfo1.bandInfo = WifiScanner.WIFI_BAND_5_GHZ; - - IfaceInfo ifaceInfo0 = new IfaceInfo(); - ifaceInfo0.name = TEST_IFACE_NAME; - ifaceInfo0.channel = 34; - IfaceInfo ifaceInfo1 = new IfaceInfo(); - ifaceInfo1.name = TEST_IFACE_NAME_1; - ifaceInfo1.channel = 36; - - radioModeInfo0.ifaceInfos.add(ifaceInfo0); - radioModeInfo0.ifaceInfos.add(ifaceInfo1); - radioModeInfo1.ifaceInfos.add(ifaceInfo0); - radioModeInfo1.ifaceInfos.add(ifaceInfo1); - - ArrayList radioModeInfos = new ArrayList<>(); - radioModeInfos.add(radioModeInfo0); - radioModeInfos.add(radioModeInfo1); - - mIWifiChipEventCallbackV12.onRadioModeChange(radioModeInfos); - // Ignored.... - - verifyNoMoreInteractions(mVendorHalRadioModeChangeHandler); - } - private void startHalInStaModeAndRegisterRadioModeChangeCallback() { // Expose the 1.2 IWifiChip. mWifiVendorHal = new WifiVendorHalSpyV1_2(mHalDeviceManager, mLooper.getLooper()); -- cgit v1.2.3