tether setting: Remove dual mode check for band convert

Some conutries don't support 5G only hotspot. Thus band convert should
not only work for dual mode device. It should general design since it
will be country dependency.

Bug: 148924644
Bug: 148764406
Test: Manual Test, use command to force country
1. adb root && adb shell cmd wifi force-country-code enabled GB
2. Change Band Setting to 5G prefer

Turn on hotspot to check log and make sure it will enable succeed.
Test:make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest

Change-Id: I7828c62ef399244531a72aa35c89b71549e0d623
This commit is contained in:
lesl
2020-02-06 16:47:46 +08:00
committed by Les Lee
parent 21276e72d6
commit 561d041f7b
3 changed files with 12 additions and 63 deletions

View File

@@ -81,7 +81,6 @@ public class WifiTetherApBandPreferenceControllerTest {
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
when(mWifiManager.getSoftApConfiguration()).thenReturn(
new SoftApConfiguration.Builder().build());
when(mWifiManager.isStaApConcurrencySupported()).thenReturn(false);
mController = new WifiTetherApBandPreferenceController(mContext, mListener);
}
@@ -90,9 +89,8 @@ public class WifiTetherApBandPreferenceControllerTest {
public void display_5GhzSupported_shouldDisplayFullList() {
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
when(mWifiManager.isStaApConcurrencySupported()).thenReturn(true);
// Create a new instance to pick the proper value of isDualModeSupported()
// Create a new instance
mController = new WifiTetherApBandPreferenceController(mContext, mListener);
mController.displayPreference(mScreen);
@@ -126,38 +124,10 @@ public class WifiTetherApBandPreferenceControllerTest {
}
@Test
public void changePreference_noDualModeWith5G_shouldUpdateValue() {
public void changePreference_With5G_shouldUpdateValue() {
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
mController.displayPreference(mScreen);
// 'Auto' option should be prevented from being set since
// it is invalid for this configuration
mController.onPreferenceChange(mPreference, VAL_2_5_GHZ_STR);
assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
verify(mListener, times(1)).onTetherConfigUpdated(mController);
// set to 5 Ghz
mController.onPreferenceChange(mPreference, VAL_5GHZ_STR);
assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
verify(mListener, times(2)).onTetherConfigUpdated(mController);
// set to 2 Ghz
mController.onPreferenceChange(mPreference, VAL_2GHZ_STR);
assertThat(mController.getBandIndex()).isEqualTo(VAL_2GHZ_INT);
assertThat(mPreference.getSummary()).isEqualTo(TWO_GHZ_STRING);
verify(mListener, times(3)).onTetherConfigUpdated(mController);
}
@Test
public void changePreference_dualModeWith5G_shouldUpdateValue() {
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
when(mWifiManager.isStaApConcurrencySupported()).thenReturn(true);
// Create a new instance to pick the proper value of isDualModeSupported()
mController = new WifiTetherApBandPreferenceController(mContext, mListener);