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

@@ -237,4 +237,11 @@ public class WifiTetherMaximizeCompatibilityPreferenceControllerTest {
assertThat(builder.build().getBand()).isEqualTo(SoftApConfiguration.BAND_2GHZ);
}
@Test
public void isAvailable_shouldHidePreference_returnFalse() {
mController.mShouldHidePreference = true;
assertThat(mController.isAvailable()).isFalse();
}
}

View File

@@ -203,4 +203,11 @@ public class WifiTetherSecurityPreferenceControllerTest {
.isEqualTo(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
assertThat(mPreference.getSummary().toString()).isEqualTo("WPA2-Personal");
}
@Test
public void isAvailable_shouldHidePreference_returnFalse() {
mController.mShouldHidePreference = true;
assertThat(mController.isAvailable()).isFalse();
}
}

View File

@@ -72,7 +72,10 @@ public class WifiTetherViewModelTest {
}
@Test
public void onCleared_setAutoRefreshFalse() {
public void onCleared_removeObservers() {
mViewModel.getSecuritySummary();
mViewModel.getSpeedSummary();
mViewModel.onCleared();
verify(mSecurityType).removeObserver(mViewModel.mSecurityTypeObserver);
@@ -116,4 +119,11 @@ public class WifiTetherViewModelTest {
assertThat(mViewModel.mSpeedSummary).isNotNull();
verify(mSpeedType).observeForever(mViewModel.mSpeedTypeObserver);
}
@Test
public void isSpeedFeatureAvailable_verifyRepositoryIsCalled() {
mViewModel.isSpeedFeatureAvailable();
verify(mWifiHotspotRepository).isSpeedFeatureAvailable();
}
}