diff options
author | Les Lee <lesl@google.com> | 2020-06-24 11:43:41 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-24 11:43:41 +0000 |
commit | f5a1794ec14fe6c329e6ed0af630c698fb94416c (patch) | |
tree | 82727dd706572d035781f34909a8c1b331999ddb | |
parent | 77f43d544032477fe5cb6be7fdbc740cdd5c007d (diff) | |
parent | 698c277154b762ecd788d7d1be69d05899710e28 (diff) |
Merge changes from topic "sap_blocked_list_enhancement" into rvc-dev am: 698c277154
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/11932655
Change-Id: If8a0f042fbfcf6b89efaae05384f41e8710c348c
7 files changed, 286 insertions, 55 deletions
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java index f9720477b..ffbb388cc 100644 --- a/service/java/com/android/server/wifi/SoftApManager.java +++ b/service/java/com/android/server/wifi/SoftApManager.java @@ -469,12 +469,17 @@ public class SoftApManager implements ActiveModeManager { return true; } + if (mBlockedClientList.contains(newClient.getMacAddress())) { + Log.d(TAG, "Force disconnect for client: " + newClient + "in blocked list"); + mWifiNative.forceClientDisconnect( + mApInterfaceName, newClient.getMacAddress(), + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); + return false; + } if (config.isClientControlByUserEnabled() && !mAllowedClientList.contains(newClient.getMacAddress())) { - if (!mBlockedClientList.contains(newClient.getMacAddress())) { - mSoftApCallback.onBlockedClientConnecting(newClient, - WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); - } + mSoftApCallback.onBlockedClientConnecting(newClient, + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); Log.d(TAG, "Force disconnect for unauthorized client: " + newClient); mWifiNative.forceClientDisconnect( mApInterfaceName, newClient.getMacAddress(), @@ -667,25 +672,22 @@ public class SoftApManager implements ActiveModeManager { } int targetDisconnectClientNumber = mConnectedClients.size() - finalMaxClientCount; List<WifiClient> allowedConnectedList = new ArrayList<>(); - if (mApConfig.getSoftApConfiguration().isClientControlByUserEnabled()) { - // Check allow list first - Iterator<WifiClient> iterator = mConnectedClients.iterator(); - while (iterator.hasNext()) { - WifiClient client = iterator.next(); - if (mAllowedClientList.contains(client.getMacAddress())) { - allowedConnectedList.add(client); - } else { - Log.d(TAG, "Force disconnect for not allowed client: " + client); - mWifiNative.forceClientDisconnect( - mApInterfaceName, client.getMacAddress(), - WifiManager - .SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); - targetDisconnectClientNumber--; - } + Iterator<WifiClient> iterator = mConnectedClients.iterator(); + while (iterator.hasNext()) { + WifiClient client = iterator.next(); + if (mBlockedClientList.contains(client.getMacAddress()) + || (mApConfig.getSoftApConfiguration().isClientControlByUserEnabled() + && !mAllowedClientList.contains(client.getMacAddress()))) { + Log.d(TAG, "Force disconnect for not allowed client: " + client); + mWifiNative.forceClientDisconnect( + mApInterfaceName, client.getMacAddress(), + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); + targetDisconnectClientNumber--; + } else { + allowedConnectedList.add(client); } - } else { - allowedConnectedList = new ArrayList<>(mConnectedClients); } + if (targetDisconnectClientNumber > 0) { Iterator<WifiClient> allowedClientIterator = allowedConnectedList.iterator(); while (allowedClientIterator.hasNext()) { diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java index 961cbbd3b..3de99711b 100644 --- a/service/java/com/android/server/wifi/WifiApConfigStore.java +++ b/service/java/com/android/server/wifi/WifiApConfigStore.java @@ -33,6 +33,7 @@ import com.android.wifi.resources.R; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; +import java.util.ArrayList; import java.util.Random; import javax.annotation.Nullable; @@ -153,10 +154,13 @@ public class WifiApConfigStore { /** * Returns SoftApConfiguration in which some parameters might be reset to supported default - * config. + * config since it depends on UI or HW. * - * MaxNumberOfClients and setClientControlByUserEnabled will need HAL support client force - * disconnect. Reset to default when device doesn't support it. + * MaxNumberOfClients and isClientControlByUserEnabled will need HAL support client force + * disconnect, and Band setting (5g/6g) need HW support. + * + * HiddenSsid, Channel, ShutdownTimeoutMillis and AutoShutdownEnabled are features + * which need UI(Setting) support. * * SAE/SAE-Transition need hardware support, reset to secured WPA2 security type when device * doesn't support it. @@ -164,15 +168,22 @@ public class WifiApConfigStore { public SoftApConfiguration resetToDefaultForUnsupportedConfig( @NonNull SoftApConfiguration config) { SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder(config); - if (!ApConfigUtil.isClientForceDisconnectSupported(mContext)) { - configBuilder.setMaxNumberOfClients(0); + if ((!ApConfigUtil.isClientForceDisconnectSupported(mContext) + || mContext.getResources().getBoolean( + R.bool.config_wifiSoftapResetUserControlConfig)) + && (config.isClientControlByUserEnabled() + || config.getBlockedClientList().size() != 0)) { configBuilder.setClientControlByUserEnabled(false); - if (config.getMaxNumberOfClients() != 0) { - Log.e(TAG, "Reset MaxNumberOfClients to 0 due to device doesn't support"); - } - if (config.isClientControlByUserEnabled()) { - Log.e(TAG, "Reset ClientControlByUser to false due to device doesn't support"); - } + configBuilder.setBlockedClientList(new ArrayList<>()); + Log.i(TAG, "Reset ClientControlByUser to false due to device doesn't support"); + } + + if ((!ApConfigUtil.isClientForceDisconnectSupported(mContext) + || mContext.getResources().getBoolean( + R.bool.config_wifiSoftapResetMaxClientSettingConfig)) + && config.getMaxNumberOfClients() != 0) { + configBuilder.setMaxNumberOfClients(0); + Log.i(TAG, "Reset MaxNumberOfClients to 0 due to device doesn't support"); } if (!ApConfigUtil.isWpa3SaeSupported(mContext) && (config.getSecurityType() @@ -181,18 +192,51 @@ public class WifiApConfigStore { == SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION)) { configBuilder.setPassphrase(generatePassword(), SoftApConfiguration.SECURITY_TYPE_WPA2_PSK); - Log.e(TAG, "Device doesn't support WPA3-SAE, reset config to WPA2"); + Log.i(TAG, "Device doesn't support WPA3-SAE, reset config to WPA2"); } - if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetChannelConfig)) { + if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetChannelConfig) + && config.getChannel() != 0) { // 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"); - } + // Add 2.4G by default + configBuilder.setBand(config.getBand() | SoftApConfiguration.BAND_2GHZ); + Log.i(TAG, "Reset SAP channel configuration"); + } + + int newBand = config.getBand(); + if (!mContext.getResources().getBoolean(R.bool.config_wifi6ghzSupport) + && (newBand & SoftApConfiguration.BAND_6GHZ) != 0) { + newBand &= ~SoftApConfiguration.BAND_6GHZ; + Log.i(TAG, "Device doesn't support 6g, remove 6G band from band setting"); } + + if (!mContext.getResources().getBoolean(R.bool.config_wifi5ghzSupport) + && (newBand & SoftApConfiguration.BAND_5GHZ) != 0) { + newBand &= ~SoftApConfiguration.BAND_5GHZ; + Log.i(TAG, "Device doesn't support 5g, remove 5G band from band setting"); + } + + if (newBand != config.getBand()) { + // Always added 2.4G by default when reset the band. + Log.i(TAG, "Reset band from " + config.getBand() + " to " + + (newBand | SoftApConfiguration.BAND_2GHZ)); + configBuilder.setBand(newBand | SoftApConfiguration.BAND_2GHZ); + } + + if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetHiddenConfig) + && config.isHiddenSsid()) { + configBuilder.setHiddenSsid(false); + Log.i(TAG, "Reset SAP Hidden Network configuration"); + } + + if (mContext.getResources().getBoolean( + R.bool.config_wifiSoftapResetAutoShutdownTimerConfig) + && config.getShutdownTimeoutMillis() != 0) { + configBuilder.setShutdownTimeoutMillis(0); + Log.i(TAG, "Reset SAP auto shutdown configuration"); + } + mWifiMetrics.noteSoftApConfigReset(config, configBuilder.build()); return configBuilder.build(); } diff --git a/service/java/com/android/server/wifi/util/ApConfigUtil.java b/service/java/com/android/server/wifi/util/ApConfigUtil.java index b385369a7..39d0df5f5 100644 --- a/service/java/com/android/server/wifi/util/ApConfigUtil.java +++ b/service/java/com/android/server/wifi/util/ApConfigUtil.java @@ -529,7 +529,8 @@ public class ApConfigUtil { SoftApCapability capability) { if (!capability.areFeaturesSupported( SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT) - && (config.getMaxNumberOfClients() != 0 || config.isClientControlByUserEnabled())) { + && (config.getMaxNumberOfClients() != 0 || config.isClientControlByUserEnabled() + || config.getBlockedClientList().size() != 0)) { Log.d(TAG, "Error, Client control requires HAL support"); return false; } diff --git a/service/res/values/config.xml b/service/res/values/config.xml index 7e35eed19..4ea23adc0 100644 --- a/service/res/values/config.xml +++ b/service/res/values/config.xml @@ -133,13 +133,24 @@ are no connected devices. --> <integer translatable="false" name="config_wifiFrameworkSoftApShutDownTimeoutMilliseconds">600000</integer> - <!-- 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 --> + <!-- boolean indicating whether or not to reset channel configuration during cloud configuration restore --> <bool translatable="false" name ="config_wifiSoftapResetChannelConfig">true</bool> + <!-- boolean indicating whether or not to reset hiddenSsid configuration during cloud configuration restore --> + <bool translatable="false" name ="config_wifiSoftapResetHiddenConfig">true</bool> + + <!-- boolean indicating whether or not to reset user control configuration during cloud configuration restore --> + <bool translatable="false" name ="config_wifiSoftapResetUserControlConfig">true</bool> + + <!-- boolean indicating whether or not to reset auto shotdown configuration during cloud configuration restore --> + <bool translatable="false" name ="config_wifiSoftapResetAutoShutdownTimerConfig">true</bool> + + <!-- boolean indicating whether or not to reset max client setting configuration during cloud configuration restore --> + <bool translatable="false" name ="config_wifiSoftapResetMaxClientSettingConfig">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 bf96fde62..b02eb9e77 100644 --- a/service/res/values/overlayable.xml +++ b/service/res/values/overlayable.xml @@ -58,6 +58,10 @@ <item type="integer" name="config_wifiFrameworkScoreGoodRssiThreshold6ghz" /> <item type="integer" name="config_wifiFrameworkSoftApShutDownTimeoutMilliseconds" /> <item type="bool" name="config_wifiSoftapResetChannelConfig" /> + <item type="bool" name="config_wifiSoftapResetHiddenConfig" /> + <item type="bool" name="config_wifiSoftapResetUserControlConfig" /> + <item type="bool" name="config_wifiSoftapResetAutoShutdownTimerConfig" /> + <item type="bool" name="config_wifiSoftapResetMaxClientSettingConfig" /> <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/SoftApManagerTest.java b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java index 99cd2db82..ddd8fe515 100644 --- a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java @@ -1190,6 +1190,92 @@ public class SoftApManagerTest extends WifiBaseTest { } @Test + public void testClientConnectFailureWhenClientInBlcokedListAndClientAuthorizationDisabled() + throws Exception { + ArrayList<MacAddress> blockedClientList = new ArrayList<>(); + mTestSoftApCapability.setMaxSupportedClients(10); + Builder configBuilder = new SoftApConfiguration.Builder(); + configBuilder.setBand(SoftApConfiguration.BAND_2GHZ); + configBuilder.setSsid(TEST_SSID); + configBuilder.setClientControlByUserEnabled(false); + // Client in blocked list + blockedClientList.add(TEST_MAC_ADDRESS); + configBuilder.setBlockedClientList(blockedClientList); + SoftApModeConfiguration apConfig = + new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, + configBuilder.build(), mTestSoftApCapability); + startSoftApAndVerifyEnabled(apConfig); + + verify(mCallback).onConnectedClientsChanged(new ArrayList<>()); + + mSoftApListenerCaptor.getValue().onConnectedClientsChanged( + TEST_NATIVE_CLIENT, true); + mLooper.dispatchAll(); + + // Client is not allow verify + verify(mWifiNative).forceClientDisconnect( + TEST_INTERFACE_NAME, TEST_MAC_ADDRESS, + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); + verify(mWifiMetrics, never()).addSoftApNumAssociatedStationsChangedEvent( + 1, apConfig.getTargetMode()); + verify(mCallback, never()).onConnectedClientsChanged( + Mockito.argThat((List<WifiClient> clients) -> + clients.contains(TEST_CONNECTED_CLIENT)) + ); + + } + + @Test + public void testClientDisconnectWhenClientInBlcokedLisUpdatedtAndClientAuthorizationDisabled() + throws Exception { + ArrayList<MacAddress> blockedClientList = new ArrayList<>(); + mTestSoftApCapability.setMaxSupportedClients(10); + Builder configBuilder = new SoftApConfiguration.Builder(); + configBuilder.setBand(SoftApConfiguration.BAND_2GHZ); + configBuilder.setSsid(TEST_SSID); + configBuilder.setClientControlByUserEnabled(false); + SoftApModeConfiguration apConfig = + new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, + configBuilder.build(), mTestSoftApCapability); + startSoftApAndVerifyEnabled(apConfig); + + verify(mCallback).onConnectedClientsChanged(new ArrayList<>()); + + mSoftApListenerCaptor.getValue().onConnectedClientsChanged( + TEST_NATIVE_CLIENT, true); + mLooper.dispatchAll(); + + // Client connected check + verify(mWifiNative, never()).forceClientDisconnect( + TEST_INTERFACE_NAME, TEST_MAC_ADDRESS, + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); + verify(mWifiMetrics).addSoftApNumAssociatedStationsChangedEvent( + 1, apConfig.getTargetMode()); + verify(mCallback, times(2)).onConnectedClientsChanged( + Mockito.argThat((List<WifiClient> clients) -> + clients.contains(TEST_CONNECTED_CLIENT)) + ); + + reset(mCallback); + reset(mWifiNative); + // Update configuration + blockedClientList.add(TEST_MAC_ADDRESS); + configBuilder.setBlockedClientList(blockedClientList); + mSoftApManager.updateConfiguration(configBuilder.build()); + mLooper.dispatchAll(); + // Client difconnected + verify(mWifiNative).forceClientDisconnect( + TEST_INTERFACE_NAME, TEST_MAC_ADDRESS, + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); + // The callback should not trigger in configuration update case. + verify(mCallback, never()).onBlockedClientConnecting(TEST_CONNECTED_CLIENT, + WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER); + + } + + + + @Test public void testForceClientDisconnectInvokeBecauseClientAuthorizationEnabled() throws Exception { mTestSoftApCapability.setMaxSupportedClients(10); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java index bc646c1eb..90e01719f 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java @@ -659,24 +659,107 @@ public class WifiApConfigStoreTest extends WifiBaseTest { @Test 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(); + mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, true); + mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, true); + mResources.setBoolean(R.bool.config_wifi6ghzSupport, true); + mResources.setBoolean(R.bool.config_wifi5ghzSupport, true); + + // Test all of the features support and all of the reset config are false. + String testPassphrase = "secretsecret"; + SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder(); + configBuilder.setPassphrase(testPassphrase, SoftApConfiguration.SECURITY_TYPE_WPA3_SAE); WifiApConfigStore store = createWifiApConfigStore(); + SoftApConfiguration resetedConfig = store.resetToDefaultForUnsupportedConfig( + configBuilder.build()); + assertEquals(resetedConfig, configBuilder.build()); - SoftApConfiguration resetedConfig = store.resetToDefaultForUnsupportedConfig(sae_config); - assertEquals(resetedConfig.getMaxNumberOfClients(), 0); - assertFalse(resetedConfig.isClientControlByUserEnabled()); + verify(mWifiMetrics).noteSoftApConfigReset(configBuilder.build(), resetedConfig); + + // Test SAE not support case. + mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, false); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertEquals(resetedConfig.getSecurityType(), SoftApConfiguration.SECURITY_TYPE_WPA2_PSK); + // Test force channel + configBuilder.setChannel(149, SoftApConfiguration.BAND_5GHZ); + mResources.setBoolean( + R.bool.config_wifiSoftapResetChannelConfig, true); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); assertEquals(resetedConfig.getChannel(), 0); assertEquals(resetedConfig.getBand(), SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ); - verify(mWifiMetrics).noteSoftApConfigReset(sae_config, resetedConfig); + + // Test forced channel band doesn't support. + mResources.setBoolean(R.bool.config_wifi5ghzSupport, false); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertEquals(resetedConfig.getChannel(), 0); + assertEquals(resetedConfig.getBand(), + SoftApConfiguration.BAND_2GHZ); + + // Test band not support with auto channel + configBuilder.setBand(SoftApConfiguration.BAND_5GHZ); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertEquals(resetedConfig.getBand(), SoftApConfiguration.BAND_2GHZ); + + // Test reset hidden network + mResources.setBoolean( + R.bool.config_wifiSoftapResetHiddenConfig, true); + configBuilder.setHiddenSsid(true); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertFalse(resetedConfig.isHiddenSsid()); + + // Test auto shutdown timer + mResources.setBoolean( + R.bool.config_wifiSoftapResetAutoShutdownTimerConfig, true); + configBuilder.setShutdownTimeoutMillis(8888); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertEquals(resetedConfig.getShutdownTimeoutMillis(), 0); + + // Test max client setting when force client disconnect doesn't support + mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false); + configBuilder.setMaxNumberOfClients(10); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertEquals(resetedConfig.getMaxNumberOfClients(), 0); + + // Test client control setting when force client disconnect doesn't support + mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false); + ArrayList<MacAddress> blockedClientList = new ArrayList<>(); + ArrayList<MacAddress> allowedClientList = new ArrayList<>(); + blockedClientList.add(MacAddress.fromString("11:22:33:44:55:66")); + allowedClientList.add(MacAddress.fromString("aa:bb:cc:dd:ee:ff")); + configBuilder.setBlockedClientList(blockedClientList); + configBuilder.setAllowedClientList(allowedClientList); + + configBuilder.setClientControlByUserEnabled(true); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertFalse(resetedConfig.isClientControlByUserEnabled()); + // The blocked list will be clean + assertEquals(resetedConfig.getBlockedClientList().size(), 0); + // The allowed list will be keep + assertEquals(resetedConfig.getAllowedClientList(), allowedClientList); + + // Test max client setting when reset enabled but force client disconnect supported + mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, true); + mResources.setBoolean( + R.bool.config_wifiSoftapResetMaxClientSettingConfig, true); + assertEquals(resetedConfig.getMaxNumberOfClients(), 0); + + // Test client control setting when reset enabled but force client disconnect supported + mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, true); + mResources.setBoolean( + R.bool.config_wifiSoftapResetUserControlConfig, true); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertFalse(resetedConfig.isClientControlByUserEnabled()); + assertEquals(resetedConfig.getBlockedClientList().size(), 0); + assertEquals(resetedConfig.getAllowedClientList(), allowedClientList); + + // Test blocked list setting will be reset even if client control disabled + mResources.setBoolean( + R.bool.config_wifiSoftapResetUserControlConfig, true); + configBuilder.setClientControlByUserEnabled(false); + resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build()); + assertFalse(resetedConfig.isClientControlByUserEnabled()); + assertEquals(resetedConfig.getBlockedClientList().size(), 0); + assertEquals(resetedConfig.getAllowedClientList(), allowedClientList); } /** |