Loading src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen // 3: With Dual mode support we can't have AP_BAND_5GHZ - default to ANY if (!isDualMode && WifiConfiguration.AP_BAND_ANY == band) { return WifiConfiguration.AP_BAND_5GHZ; } else if (!mWifiManager.is5GHzBandSupported() && WifiConfiguration.AP_BAND_5GHZ == band) { } else if (!is5GhzBandSupported() && WifiConfiguration.AP_BAND_5GHZ == band) { return WifiConfiguration.AP_BAND_2GHZ; } else if (isDualMode && WifiConfiguration.AP_BAND_5GHZ == band) { return WifiConfiguration.AP_BAND_ANY; Loading tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void display_5GhzNotSupported_shouldDisable() { when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(false); mController.displayPreference(mScreen); Loading @@ -116,7 +117,8 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void changePreference_noDualModeWith5G_shouldUpdateValue() { when(mWifiManager.is5GHzBandSupported()).thenReturn(true); when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(true); mController.displayPreference(mScreen); Loading @@ -142,7 +144,8 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void changePreference_dualModeWith5G_shouldUpdateValue() { when(mWifiManager.is5GHzBandSupported()).thenReturn(true); when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(true); when(mWifiManager.isDualModeSupported()).thenReturn(true); mController.displayPreference(mScreen); Loading @@ -168,14 +171,16 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void updateDisplay_shouldUpdateValue() { when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(true); // Set controller band index to 1 and verify is set. when(mWifiManager.is5GHzBandSupported()).thenReturn(true); mController.displayPreference(mScreen); mController.onPreferenceChange(mPreference, "1"); assertThat(mController.getBandIndex()).isEqualTo(1); // Disable 5Ghz band when(mWifiManager.is5GHzBandSupported()).thenReturn(false); when(mWifiManager.isDualBandSupported()).thenReturn(false); // Call updateDisplay and verify it's changed. mController.updateDisplay(); Loading Loading
src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen // 3: With Dual mode support we can't have AP_BAND_5GHZ - default to ANY if (!isDualMode && WifiConfiguration.AP_BAND_ANY == band) { return WifiConfiguration.AP_BAND_5GHZ; } else if (!mWifiManager.is5GHzBandSupported() && WifiConfiguration.AP_BAND_5GHZ == band) { } else if (!is5GhzBandSupported() && WifiConfiguration.AP_BAND_5GHZ == band) { return WifiConfiguration.AP_BAND_2GHZ; } else if (isDualMode && WifiConfiguration.AP_BAND_5GHZ == band) { return WifiConfiguration.AP_BAND_ANY; Loading
tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void display_5GhzNotSupported_shouldDisable() { when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(false); mController.displayPreference(mScreen); Loading @@ -116,7 +117,8 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void changePreference_noDualModeWith5G_shouldUpdateValue() { when(mWifiManager.is5GHzBandSupported()).thenReturn(true); when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(true); mController.displayPreference(mScreen); Loading @@ -142,7 +144,8 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void changePreference_dualModeWith5G_shouldUpdateValue() { when(mWifiManager.is5GHzBandSupported()).thenReturn(true); when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(true); when(mWifiManager.isDualModeSupported()).thenReturn(true); mController.displayPreference(mScreen); Loading @@ -168,14 +171,16 @@ public class WifiTetherApBandPreferenceControllerTest { @Test public void updateDisplay_shouldUpdateValue() { when(mWifiManager.getCountryCode()).thenReturn("US"); when(mWifiManager.isDualBandSupported()).thenReturn(true); // Set controller band index to 1 and verify is set. when(mWifiManager.is5GHzBandSupported()).thenReturn(true); mController.displayPreference(mScreen); mController.onPreferenceChange(mPreference, "1"); assertThat(mController.getBandIndex()).isEqualTo(1); // Disable 5Ghz band when(mWifiManager.is5GHzBandSupported()).thenReturn(false); when(mWifiManager.isDualBandSupported()).thenReturn(false); // Call updateDisplay and verify it's changed. mController.updateDisplay(); Loading