Add Wi-Fi hotspot > Security Settings page

- Restrict low security type when 6 GHz band is selected
  - Disable "WPA2/WPA3-Personal" security type
  - Disable "WPA2-Personal" security type
  - Disable "None" security type

- Automatically updated security type to WPA3 when 6 GHz band is selected
  - Regenerate password when security type is changed from None

Bug: 245258763
Test: manual test
atest -c WifiTetherSettingsTest
atest -c WifiTetherViewModelTest \
         WifiHotspotSecuritySettingsTest \
         WifiHotspotSecurityViewModelTest \
         WifiHotspotRepositoryTest

Change-Id: I31b08795419baed10dc40b876aeec175f6f41e69
This commit is contained in:
Weng Su
2023-04-10 23:31:50 +08:00
parent 211b544ea8
commit 9f80cd2f77
14 changed files with 1019 additions and 28 deletions

View File

@@ -72,6 +72,8 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
static final String KEY_WIFI_TETHER_MAXIMIZE_COMPATIBILITY =
WifiTetherMaximizeCompatibilityPreferenceController.PREF_KEY;
@VisibleForTesting
static final String KEY_WIFI_HOTSPOT_SECURITY = "wifi_hotspot_security";
@VisibleForTesting
static final String KEY_WIFI_HOTSPOT_SPEED = "wifi_hotspot_speed";
private WifiTetherSwitchBarController mSwitchBarController;
@@ -91,6 +93,8 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
@VisibleForTesting
WifiTetherViewModel mWifiTetherViewModel;
@VisibleForTesting
Preference mWifiHotspotSecurity;
@VisibleForTesting
Preference mWifiHotspotSpeed;
static {
@@ -132,6 +136,10 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
mWifiTetherViewModel = FeatureFactory.getFactory(getContext()).getWifiFeatureProvider()
.getWifiTetherViewModel(this);
mWifiHotspotSecurity = findPreference(KEY_WIFI_HOTSPOT_SECURITY);
if (mWifiHotspotSecurity != null && mWifiHotspotSecurity.isVisible()) {
mWifiTetherViewModel.getSecuritySummary().observe(this, this::onSecuritySummaryChanged);
}
mWifiHotspotSpeed = findPreference(KEY_WIFI_HOTSPOT_SPEED);
if (mWifiHotspotSpeed != null && mWifiHotspotSpeed.isVisible()) {
mWifiTetherViewModel.getSpeedSummary().observe(this, this::onSpeedSummaryChanged);
@@ -206,6 +214,10 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
}
}
protected void onSecuritySummaryChanged(Integer securityResId) {
mWifiHotspotSecurity.setSummary(securityResId);
}
protected void onSpeedSummaryChanged(Integer summaryResId) {
mWifiHotspotSpeed.setSummary(summaryResId);
}