use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherSSIDPreferenceControllerTest method displayPreference_hasCustomWifiConfig_shouldDisplayCustomSSID.
@Test
public void displayPreference_hasCustomWifiConfig_shouldDisplayCustomSSID() {
final SoftApConfiguration config = new SoftApConfiguration.Builder().setSsid("test_1234").build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
mController.displayPreference(mScreen);
assertThat(mController.getSSID()).isEqualTo(config.getSsid());
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherSSIDPreferenceControllerTest method displayPreference_wifiApEnabled_shouldShowQrCodeIcon.
@Test
public void displayPreference_wifiApEnabled_shouldShowQrCodeIcon() {
when(mWifiManager.isWifiApEnabled()).thenReturn(true);
final SoftApConfiguration config = new SoftApConfiguration.Builder().setSsid("test_1234").setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA2_PSK).build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
mController.displayPreference(mScreen);
assertThat(mController.isQrCodeButtonAvailable()).isEqualTo(true);
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class AllInOneTetherSettings method onTetherConfigUpdated.
@Override
public void onTetherConfigUpdated(AbstractPreferenceController controller) {
final SoftApConfiguration config = buildNewConfig();
mPasswordPreferenceController.setSecurityType(config.getSecurityType());
mWifiManager.setSoftApConfiguration(config);
if (mWifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_ENABLED) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Wifi AP config changed while enabled, stop and restart");
}
mRestartWifiApAfterConfigChange = true;
mTetherEnabler.stopTethering(TETHERING_WIFI);
}
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherMaximizeCompatibilityPreferenceController method isMaximizeCompatibilityEnabled.
@VisibleForTesting
boolean isMaximizeCompatibilityEnabled() {
if (mWifiManager == null) {
return false;
}
final SoftApConfiguration config = mWifiManager.getSoftApConfiguration();
if (config == null) {
return false;
}
if (mWifiManager.isBridgedApConcurrencySupported()) {
final boolean isEnabled = config.isBridgedModeOpportunisticShutdownEnabled();
Log.d(TAG, "isBridgedModeOpportunisticShutdownEnabled:" + isEnabled);
// Need to return the reverse value.
return !isEnabled;
}
// If the BridgedAp Concurrency is not supported in early Pixel devices (e.g. Pixel 2~5),
// show toggle on when band is 2.4G only.
final int band = config.getBand();
Log.d(TAG, "getBand:" + band);
return band == SoftApConfiguration.BAND_2GHZ;
}
use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.
the class WifiTetherAutoOffPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
SoftApConfiguration softApConfiguration = mWifiManager.getSoftApConfiguration();
final boolean settingsOn = softApConfiguration.isAutoShutdownEnabled();
((SwitchPreference) preference).setChecked(settingsOn);
}
Aggregations