Merge "Migrate existing Build.VERSION.SDK_INT checks to SdkLevelUtil"
This commit is contained in:
@@ -16,10 +16,11 @@
|
||||
|
||||
package android.net.wifi;
|
||||
|
||||
import android.os.Build;
|
||||
import android.net.wifi.util.SdkLevelUtil;
|
||||
import android.os.Parcel;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
@@ -92,14 +93,12 @@ public class SoftApCapabilityTest {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testGetSupportedChannelListWithInvalidBand() {
|
||||
assumeTrue(SdkLevelUtil.isAtLeastS());
|
||||
|
||||
long testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT
|
||||
| SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD;
|
||||
SoftApCapability capability = new SoftApCapability(testSoftApFeature);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
capability.getSupportedChannelList(
|
||||
SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ);
|
||||
} else {
|
||||
throw new IllegalArgumentException("API doesn't support in current SDK version");
|
||||
}
|
||||
capability.getSupportedChannelList(
|
||||
SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import android.net.MacAddress;
|
||||
import android.os.Build;
|
||||
import android.net.wifi.util.SdkLevelUtil;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
@@ -81,7 +81,7 @@ public class SoftApConfigurationTest {
|
||||
assertThat(original.getChannel()).isEqualTo(0);
|
||||
assertThat(original.isHiddenSsid()).isEqualTo(false);
|
||||
assertThat(original.getMaxNumberOfClients()).isEqualTo(0);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
if (SdkLevelUtil.isAtLeastS()) {
|
||||
assertThat(original.getMacRandomizationSetting())
|
||||
.isEqualTo(SoftApConfiguration.RANDOMIZATION_PERSISTENT);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class SoftApConfigurationTest {
|
||||
.setClientControlByUserEnabled(true)
|
||||
.setBlockedClientList(testBlockedClientList)
|
||||
.setAllowedClientList(testAllowedClientList);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
if (SdkLevelUtil.isAtLeastS()) {
|
||||
originalBuilder.setMacRandomizationSetting(SoftApConfiguration.RANDOMIZATION_NONE);
|
||||
}
|
||||
SoftApConfiguration original = originalBuilder.build();
|
||||
@@ -153,7 +153,7 @@ public class SoftApConfigurationTest {
|
||||
assertThat(original.isClientControlByUserEnabled()).isEqualTo(true);
|
||||
assertThat(original.getBlockedClientList()).isEqualTo(testBlockedClientList);
|
||||
assertThat(original.getAllowedClientList()).isEqualTo(testAllowedClientList);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
if (SdkLevelUtil.isAtLeastS()) {
|
||||
assertThat(original.getMacRandomizationSetting())
|
||||
.isEqualTo(SoftApConfiguration.RANDOMIZATION_NONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user