Search in sources :

Example 21 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class DeviceNamePreferenceController method setTetherSsidName.

private void setTetherSsidName(String deviceName) {
    final SoftApConfiguration config = mWifiManager.getSoftApConfiguration();
    // TODO: If tether is running, turn off the AP and restart it after setting config.
    mWifiManager.setSoftApConfiguration(new SoftApConfiguration.Builder(config).setSsid(deviceName).build());
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration)

Example 22 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class HotspotConditionControllerTest method setupSoftApConfiguration.

private void setupSoftApConfiguration() {
    final SoftApConfiguration wifiApConfig = new SoftApConfiguration.Builder().setSsid(WIFI_AP_SSID).build();
    mContext.getSystemService(WifiManager.class).setSoftApConfiguration(wifiApConfig);
}
Also used : WifiManager(android.net.wifi.WifiManager) ShadowWifiManager(com.android.settings.testutils.shadow.ShadowWifiManager) SoftApConfiguration(android.net.wifi.SoftApConfiguration)

Example 23 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherPasswordPreferenceControllerTest method updateDisplay_shouldSetInputType.

@Test
public void updateDisplay_shouldSetInputType() {
    // Set controller password to anything and verify is set.
    mController.displayPreference(mScreen);
    mController.onPreferenceChange(mPreference, VALID_PASS);
    assertThat(mController.getPasswordValidated(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK)).isEqualTo(VALID_PASS);
    // Create a new config using different password
    final SoftApConfiguration config = new SoftApConfiguration.Builder().setPassphrase(VALID_PASS2, SoftApConfiguration.SECURITY_TYPE_WPA2_PSK).build();
    when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
    // Call updateDisplay and verify it's changed.
    mController.updateDisplay();
    assertThat(mPreference.isPassword()).isTrue();
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 24 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherSSIDPreferenceControllerTest method displayPreference_wifiApDisabled_shouldHideQrCodeIcon.

@Test
public void displayPreference_wifiApDisabled_shouldHideQrCodeIcon() {
    when(mWifiManager.isWifiApEnabled()).thenReturn(false);
    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(false);
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 25 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherMaximizeCompatibilityPreferenceControllerTest method isMaximizeCompatibilityEnabled_noConcurrencyAndGetBand2gOnly_returnFalse.

@Test
public void isMaximizeCompatibilityEnabled_noConcurrencyAndGetBand2gOnly_returnFalse() {
    doReturn(false).when(mWifiManager).isBridgedApConcurrencySupported();
    SoftApConfiguration config = new SoftApConfiguration.Builder().setBand(SoftApConfiguration.BAND_2GHZ).build();
    doReturn(config).when(mWifiManager).getSoftApConfiguration();
    assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(true);
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Aggregations

SoftApConfiguration (android.net.wifi.SoftApConfiguration)28 Test (org.junit.Test)16 ValidatedEditTextPreference (com.android.settings.widget.ValidatedEditTextPreference)3 VisibleForTesting (androidx.annotation.VisibleForTesting)2 Intent (android.content.Intent)1 WifiManager (android.net.wifi.WifiManager)1 ListPreference (androidx.preference.ListPreference)1 PreferenceManager (androidx.preference.PreferenceManager)1 SwitchPreference (androidx.preference.SwitchPreference)1 ShadowWifiManager (com.android.settings.testutils.shadow.ShadowWifiManager)1 Before (org.junit.Before)1