summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/HostapdHal.java3
-rw-r--r--service/res/values/config.xml3
-rw-r--r--service/res/values/overlayable.xml1
-rw-r--r--tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java39
4 files changed, 45 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/HostapdHal.java b/service/java/com/android/server/wifi/HostapdHal.java
index 6ef0a7f86..1ff8368e3 100644
--- a/service/java/com/android/server/wifi/HostapdHal.java
+++ b/service/java/com/android/server/wifi/HostapdHal.java
@@ -424,7 +424,8 @@ public class HostapdHal {
&& !mForceApChannel;
if (enableAcs) {
ifaceParams.channelParams.enableAcs = true;
- ifaceParams.channelParams.acsShouldExcludeDfs = true;
+ ifaceParams.channelParams.acsShouldExcludeDfs = !mContext.getResources()
+ .getBoolean(R.bool.config_wifiSoftapAcsIncludeDfs);
}
ifaceParams.channelParams.channel =
mForceApChannel ? mForcedApChannel : config.getChannel();
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index 5d8a47ca9..635b3ada1 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -414,4 +414,7 @@
<integer translatable="false" name="config_wifiMaxNativeFailureSelfRecoveryPerHour">2</integer>
<!-- Ignore the open saved network if from carrier provisioning app, there is a same open suggestion and a secure suggestion from same carrier available -->
<bool translatable="false" name="config_wifiIgnoreOpenSavedNetworkWhenSecureSuggestionAvailable">true</bool>
+
+ <!-- Wifi driver Automatic channel selection (ACS) for softap to include DFS channels -->
+ <bool translatable="false" name="config_wifiSoftapAcsIncludeDfs">false</bool>
</resources>
diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml
index d0dd87525..52ef09e4f 100644
--- a/service/res/values/overlayable.xml
+++ b/service/res/values/overlayable.xml
@@ -130,6 +130,7 @@
<item type="bool" name="config_wifiSaeUpgradeOffloadEnabled" />
<item type="integer" name="config_wifiMaxNativeFailureSelfRecoveryPerHour" />
<item type="bool" name="config_wifiIgnoreOpenSavedNetworkWhenSecureSuggestionAvailable" />
+ <item type="bool" name="config_wifiSoftapAcsIncludeDfs" />
<!-- Params from config.xml that can be overlayed -->
<!-- Params from strings.xml that can be overlayed -->
diff --git a/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java b/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java
index 52a28eafe..8f8c7a52e 100644
--- a/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java
@@ -137,6 +137,7 @@ public class HostapdHalTest extends WifiBaseTest {
mResources.setBoolean(R.bool.config_wifi_softap_ieee80211ac_supported, false);
mResources.setBoolean(R.bool.config_wifiSoftapIeee80211axSupported, false);
mResources.setBoolean(R.bool.config_wifiSoftap6ghzSupported, false);
+ mResources.setBoolean(R.bool.config_wifiSoftapAcsIncludeDfs, false);
mResources.setString(R.string.config_wifiSoftap2gChannelList, "");
mResources.setString(R.string.config_wifiSoftap5gChannelList, "");
mResources.setString(R.string.config_wifiSoftap6gChannelList, "");
@@ -1040,5 +1041,43 @@ public class HostapdHalTest extends WifiBaseTest {
configurationBuilder.build(),
() -> mSoftApListener.onFailure()));
}
+
+ /**
+ * Verifies the successful addition of access point when ACS is allowed to include DFS channels.
+ */
+ @Test
+ public void testAddAccessPointSuccess_WithACS_IncludeDFSChannels() throws Exception {
+ // Enable ACS in the config.
+ mResources.setBoolean(R.bool.config_wifi_softap_acs_supported, true);
+ mResources.setBoolean(R.bool.config_wifiSoftapAcsIncludeDfs, true);
+ mHostapdHal = new HostapdHalSpy();
+
+ executeAndValidateInitializationSequence();
+
+ Builder configurationBuilder = new SoftApConfiguration.Builder();
+ configurationBuilder.setSsid(NETWORK_SSID);
+ configurationBuilder.setHiddenSsid(false);
+ configurationBuilder.setPassphrase(NETWORK_PSK,
+ SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
+ configurationBuilder.setBand(SoftApConfiguration.BAND_ANY);
+
+ assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME,
+ configurationBuilder.build(),
+ () -> mSoftApListener.onFailure()));
+ verify(mIHostapdMock).addAccessPoint(any(), any());
+
+ assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName);
+ assertTrue(mIfaceParamsCaptor.getValue().hwModeParams.enable80211N);
+ assertFalse(mIfaceParamsCaptor.getValue().hwModeParams.enable80211AC);
+ assertEquals(IHostapd.Band.BAND_ANY, mIfaceParamsCaptor.getValue().channelParams.band);
+ assertTrue(mIfaceParamsCaptor.getValue().channelParams.enableAcs);
+ assertFalse(mIfaceParamsCaptor.getValue().channelParams.acsShouldExcludeDfs);
+
+ assertEquals(NativeUtil.stringToByteArrayList(NETWORK_SSID),
+ mNetworkParamsCaptor.getValue().ssid);
+ assertFalse(mNetworkParamsCaptor.getValue().isHidden);
+ assertEquals(IHostapd.EncryptionType.WPA2, mNetworkParamsCaptor.getValue().encryptionType);
+ assertEquals(NETWORK_PSK, mNetworkParamsCaptor.getValue().pskPassphrase);
+ }
}