Fallback to "Extended Compatibility" if Speed feature is not ready

- Fallback to the "Extended Compatibility" design when the following conditions occur
  - 5 GHz band is not supported on the device
  - 5 GHz SAP available channels cannot be obtained from WifiManager
  - 6 GHz SAP available channels cannot be obtained from WifiManager

Bug: 272450463
Test: manual test
atest -c WifiTetherSettingsTest
atest -c WifiTetherViewModelTest \
         WifiHotspotRepositoryTest \
         WifiTetherSecurityPreferenceControllerTest.java \
         WifiTetherMaximizeCompatibilityPreferenceControllerTest

Change-Id: If7c8c41ebe86f5e7d8e4737ab7a82d38c9d633de
This commit is contained in:
Weng Su
2023-04-17 12:20:42 +08:00
parent 019e8ceb72
commit d965ff3049
10 changed files with 278 additions and 33 deletions

View File

@@ -136,12 +136,22 @@ 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);
if (mWifiTetherViewModel != null) {
setupSpeedFeature(mWifiTetherViewModel.isSpeedFeatureAvailable());
}
}
@VisibleForTesting
void setupSpeedFeature(boolean isSpeedFeatureAvailable) {
mWifiHotspotSecurity = findPreference(KEY_WIFI_HOTSPOT_SECURITY);
mWifiHotspotSpeed = findPreference(KEY_WIFI_HOTSPOT_SPEED);
if (mWifiHotspotSpeed != null && mWifiHotspotSpeed.isVisible()) {
if (mWifiHotspotSecurity == null || mWifiHotspotSpeed == null) {
return;
}
mWifiHotspotSecurity.setVisible(isSpeedFeatureAvailable);
mWifiHotspotSpeed.setVisible(isSpeedFeatureAvailable);
if (isSpeedFeatureAvailable) {
mWifiTetherViewModel.getSecuritySummary().observe(this, this::onSecuritySummaryChanged);
mWifiTetherViewModel.getSpeedSummary().observe(this, this::onSpeedSummaryChanged);
}
}