diff options
author | Les Lee <lesl@google.com> | 2020-06-21 07:25:12 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-21 07:25:12 +0000 |
commit | 89992ba363d9044eddf40536f6c2a34767f404c4 (patch) | |
tree | 8de866007ba46bad7cf06b9500110f7c1d842dd2 | |
parent | 0bb1efc5ad14432e55cd42b832f528eb6ec2a54c (diff) | |
parent | 1b54aaf083cf2e32be685e51993f6a092cbed50a (diff) |
Merge "wifi: Add new overlay to control reset channel config." into rvc-dev am: 6ea82ec26a am: 1b54aaf083
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/11910206
Change-Id: I7d3e7c9b96a68dffd42975d67b6a642cefa2dbe9
-rw-r--r-- | service/java/com/android/server/wifi/WifiApConfigStore.java | 10 | ||||
-rw-r--r-- | service/res/values/config.xml | 3 | ||||
-rw-r--r-- | service/res/values/overlayable.xml | 1 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java | 5 |
4 files changed, 19 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java index 4921f8c7d..961cbbd3b 100644 --- a/service/java/com/android/server/wifi/WifiApConfigStore.java +++ b/service/java/com/android/server/wifi/WifiApConfigStore.java @@ -183,6 +183,16 @@ public class WifiApConfigStore { SoftApConfiguration.SECURITY_TYPE_WPA2_PSK); Log.e(TAG, "Device doesn't support WPA3-SAE, reset config to WPA2"); } + + if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetChannelConfig)) { + // The device might not support customize channel or forced channel might not + // work in some countries. Need to reset it. + if (config.getChannel() != 0) { + // Add 2.4G by default + configBuilder.setBand(SoftApConfiguration.BAND_2GHZ | config.getBand()); + Log.i(TAG, "Reset SAP channel configuration"); + } + } mWifiMetrics.noteSoftApConfigReset(config, configBuilder.build()); return configBuilder.build(); } diff --git a/service/res/values/config.xml b/service/res/values/config.xml index ad454c10a..7e35eed19 100644 --- a/service/res/values/config.xml +++ b/service/res/values/config.xml @@ -137,6 +137,9 @@ <!-- Integer indicating maximum hardware supported client number of soft ap --> <integer translatable="false" name="config_wifiHardwareSoftapMaxClientCount">16</integer> + <!-- boolean indicating whether reset channel configuration or not during cloud configuration restore --> + <bool translatable="false" name ="config_wifiSoftapResetChannelConfig">true</bool> + <!-- List of allowed channels in 2GHz band for softap. If the device doesn't want to restrict channels this should be empty. Values is a comma separated channel string and/or channel range string like '1-6,11'. --> diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml index cab5bbfb4..bf96fde62 100644 --- a/service/res/values/overlayable.xml +++ b/service/res/values/overlayable.xml @@ -57,6 +57,7 @@ <item type="integer" name="config_wifiFrameworkScoreLowRssiThreshold6ghz" /> <item type="integer" name="config_wifiFrameworkScoreGoodRssiThreshold6ghz" /> <item type="integer" name="config_wifiFrameworkSoftApShutDownTimeoutMilliseconds" /> + <item type="bool" name="config_wifiSoftapResetChannelConfig" /> <item type="string" name="config_wifiSoftap2gChannelList" /> <item type="string" name="config_wifiSoftap5gChannelList" /> <item type="string" name="config_wifiSoftap6gChannelList" /> diff --git a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java index 50fd4d8c1..bc646c1eb 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java @@ -661,16 +661,21 @@ public class WifiApConfigStoreTest extends WifiBaseTest { public void testResetToDefaultForUnsupportedConfig() throws Exception { mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false); mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, false); + mResources.setBoolean(R.bool.config_wifiSoftapResetChannelConfig, true); SoftApConfiguration sae_config = new SoftApConfiguration.Builder() .setPassphrase("secretsecret", SoftApConfiguration.SECURITY_TYPE_WPA3_SAE) .setMaxNumberOfClients(10) .setClientControlByUserEnabled(true) + .setChannel(149, SoftApConfiguration.BAND_5GHZ) .build(); WifiApConfigStore store = createWifiApConfigStore(); SoftApConfiguration resetedConfig = store.resetToDefaultForUnsupportedConfig(sae_config); assertEquals(resetedConfig.getMaxNumberOfClients(), 0); assertFalse(resetedConfig.isClientControlByUserEnabled()); + assertEquals(resetedConfig.getChannel(), 0); + assertEquals(resetedConfig.getBand(), + SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ); verify(mWifiMetrics).noteSoftApConfigReset(sae_config, resetedConfig); } |