use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherSecurityPreferenceControllerTest method updateDisplay_toWpa3SaeTransitionButNotSupportWpa3_shouldBeDefaultToWpa2.
@Test
public void updateDisplay_toWpa3SaeTransitionButNotSupportWpa3_shouldBeDefaultToWpa2() {
mController.mIsWpa3Supported = false;
SoftApConfiguration config = new SoftApConfiguration.Builder(mConfig).setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION).build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
mController.updateDisplay();
assertThat(mController.getSecurityType()).isEqualTo(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
assertThat(mPreference.getSummary().toString()).isEqualTo("WPA2-Personal");
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherSecurityPreferenceControllerTest method updateDisplay_toWpa3Sae_shouldUpdateSecurityValue.
@Test
public void updateDisplay_toWpa3Sae_shouldUpdateSecurityValue() {
SoftApConfiguration config = new SoftApConfiguration.Builder(mConfig).setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA3_SAE).build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
mController.updateDisplay();
assertThat(mController.getSecurityType()).isEqualTo(SoftApConfiguration.SECURITY_TYPE_WPA3_SAE);
assertThat(mPreference.getSummary().toString()).isEqualTo("WPA3-Personal");
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherSecurityPreferenceControllerTest method updateDisplay_toWpa3SaeButNotSupportWpa3_shouldBeDefaultToWpa2.
@Test
public void updateDisplay_toWpa3SaeButNotSupportWpa3_shouldBeDefaultToWpa2() {
mController.mIsWpa3Supported = false;
SoftApConfiguration config = new SoftApConfiguration.Builder(mConfig).setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA3_SAE).build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
mController.updateDisplay();
assertThat(mController.getSecurityType()).isEqualTo(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
assertThat(mPreference.getSummary().toString()).isEqualTo("WPA2-Personal");
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherSecurityPreferenceControllerTest method updateDisplay_toNone_shouldUpdateSecurityValue.
@Test
public void updateDisplay_toNone_shouldUpdateSecurityValue() {
SoftApConfiguration config = new SoftApConfiguration.Builder(mConfig).setPassphrase(null, SoftApConfiguration.SECURITY_TYPE_OPEN).build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
mController.updateDisplay();
assertThat(mController.getSecurityType()).isEqualTo(SoftApConfiguration.SECURITY_TYPE_OPEN);
assertThat(mPreference.getSummary().toString()).isEqualTo("None");
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherApBandPreferenceController method updateDisplay.
@Override
public void updateDisplay() {
final SoftApConfiguration config = mWifiManager.getSoftApConfiguration();
if (config == null) {
mBandIndex = SoftApConfiguration.BAND_2GHZ;
Log.d(TAG, "Updating band index to BAND_2GHZ because no config");
} else if (is5GhzBandSupported()) {
mBandIndex = validateSelection(config.getBand());
Log.d(TAG, "Updating band index to " + mBandIndex);
} else {
mWifiManager.setSoftApConfiguration(new SoftApConfiguration.Builder(config).setBand(SoftApConfiguration.BAND_2GHZ).build());
mBandIndex = SoftApConfiguration.BAND_2GHZ;
Log.d(TAG, "5Ghz not supported, updating band index to 2GHz");
}
ListPreference preference = (ListPreference) mPreference;
preference.setEntries(mBandSummaries);
preference.setEntryValues(mBandEntries);
if (!is5GhzBandSupported()) {
preference.setEnabled(false);
preference.setSummary(R.string.wifi_ap_choose_2G);
} else {
preference.setValue(Integer.toString(config.getBand()));
preference.setSummary(getConfigSummary());
}
}
Aggregations