summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiVendorHal.java27
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java120
2 files changed, 12 insertions, 135 deletions
diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java
index 1e622ca1b..6041a681f 100644
--- a/service/java/com/android/server/wifi/WifiVendorHal.java
+++ b/service/java/com/android/server/wifi/WifiVendorHal.java
@@ -2965,13 +2965,12 @@ public class WifiVendorHal {
mLog.e("Unexpected number of radio info in list " + radioModeInfoList.size());
return;
}
- // Not concurrency scenario, uninteresting...
- if (radioModeInfoList.size() == 1) return;
-
RadioModeInfo radioModeInfo0 = radioModeInfoList.get(0);
- RadioModeInfo radioModeInfo1 = radioModeInfoList.get(1);
+ RadioModeInfo radioModeInfo1 =
+ radioModeInfoList.size() == 2 ? radioModeInfoList.get(1) : null;
// Number of ifaces on each radio should be equal.
- if (radioModeInfo0.ifaceInfos.size() != radioModeInfo1.ifaceInfos.size()) {
+ if (radioModeInfo1 != null
+ && radioModeInfo0.ifaceInfos.size() != radioModeInfo1.ifaceInfos.size()) {
mLog.e("Unexpected number of iface info in list "
+ radioModeInfo0.ifaceInfos.size() + ", "
+ radioModeInfo1.ifaceInfos.size());
@@ -2984,7 +2983,7 @@ public class WifiVendorHal {
return;
}
// 2 ifaces simultaneous on 2 radios.
- if (numIfacesOnEachRadio == 1) {
+ if (radioModeInfoList.size() == 2 && numIfacesOnEachRadio == 1) {
// Iface on radio0 should be different from the iface on radio1 for DBS & SBS.
if (areSameIfaceNames(radioModeInfo0.ifaceInfos, radioModeInfo1.ifaceInfos)) {
mLog.e("Unexpected for both radio infos to have same iface");
@@ -2995,18 +2994,8 @@ public class WifiVendorHal {
} else {
handler.onSbs(radioModeInfo0.bandInfo);
}
- // 2 ifaces time sharing on 2 radios.
- } else {
- // Ifaces on radio0 & radio1 should be the same for MCC & SCC.
- if (!areSameIfaces(radioModeInfo0.ifaceInfos, radioModeInfo1.ifaceInfos)) {
- mLog.e("Unexpected for both radio infos to have different ifaces");
- return;
- }
- // Both radio0 & radio1 should now be in the same band (could be 5G or 2G).
- if (radioModeInfo0.bandInfo != radioModeInfo1.bandInfo) {
- mLog.e("Unexpected for both radio infos to have different band");
- return;
- }
+ // 2 ifaces time sharing on 1 radio.
+ } else if (radioModeInfoList.size() == 1 && numIfacesOnEachRadio == 2) {
IfaceInfo ifaceInfo0 = radioModeInfo0.ifaceInfos.get(0);
IfaceInfo ifaceInfo1 = radioModeInfo0.ifaceInfos.get(1);
if (ifaceInfo0.channel != ifaceInfo1.channel) {
@@ -3014,6 +3003,8 @@ public class WifiVendorHal {
} else {
handler.onScc(radioModeInfo0.bandInfo);
}
+ } else {
+ // Not concurrency scenario, uninteresting...
}
}
}
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<RadioModeInfo> 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<RadioModeInfo> 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<RadioModeInfo> 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<RadioModeInfo> 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<RadioModeInfo> 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());