Merge "softap: Add BAND_60GHZ to SoftApConfiguration"
This commit is contained in:
@@ -35,6 +35,7 @@ package android.net.wifi {
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.ScanResult> CREATOR;
|
||||
field public String SSID;
|
||||
field public static final int WIFI_STANDARD_11AC = 5; // 0x5
|
||||
field public static final int WIFI_STANDARD_11AD = 7; // 0x7
|
||||
field public static final int WIFI_STANDARD_11AX = 6; // 0x6
|
||||
field public static final int WIFI_STANDARD_11N = 4; // 0x4
|
||||
field public static final int WIFI_STANDARD_LEGACY = 1; // 0x1
|
||||
|
||||
@@ -277,6 +277,7 @@ package android.net.wifi {
|
||||
method @Nullable public android.net.wifi.WifiConfiguration toWifiConfiguration();
|
||||
field public static final int BAND_2GHZ = 1; // 0x1
|
||||
field public static final int BAND_5GHZ = 2; // 0x2
|
||||
field public static final int BAND_60GHZ = 8; // 0x8
|
||||
field public static final int BAND_6GHZ = 4; // 0x4
|
||||
field @Deprecated public static final int BAND_ANY = 7; // 0x7
|
||||
field public static final int RANDOMIZATION_NONE = 0; // 0x0
|
||||
@@ -314,9 +315,13 @@ package android.net.wifi {
|
||||
field public static final int CHANNEL_WIDTH_160MHZ = 6; // 0x6
|
||||
field public static final int CHANNEL_WIDTH_20MHZ = 2; // 0x2
|
||||
field public static final int CHANNEL_WIDTH_20MHZ_NOHT = 1; // 0x1
|
||||
field public static final int CHANNEL_WIDTH_2160MHZ = 7; // 0x7
|
||||
field public static final int CHANNEL_WIDTH_40MHZ = 3; // 0x3
|
||||
field public static final int CHANNEL_WIDTH_4320MHZ = 8; // 0x8
|
||||
field public static final int CHANNEL_WIDTH_6480MHZ = 9; // 0x9
|
||||
field public static final int CHANNEL_WIDTH_80MHZ = 4; // 0x4
|
||||
field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 5; // 0x5
|
||||
field public static final int CHANNEL_WIDTH_8640MHZ = 10; // 0xa
|
||||
field public static final int CHANNEL_WIDTH_INVALID = 0; // 0x0
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.SoftApInfo> CREATOR;
|
||||
}
|
||||
|
||||
@@ -319,6 +319,11 @@ public final class ScanResult implements Parcelable {
|
||||
*/
|
||||
public static final int WIFI_STANDARD_11AX = 6;
|
||||
|
||||
/**
|
||||
* Wi-Fi 802.11ad/ay
|
||||
*/
|
||||
public static final int WIFI_STANDARD_11AD = 7;
|
||||
|
||||
/**
|
||||
* AP wifi standard.
|
||||
*/
|
||||
@@ -352,6 +357,8 @@ public final class ScanResult implements Parcelable {
|
||||
return "11ac";
|
||||
case WIFI_STANDARD_11AX:
|
||||
return "11ax";
|
||||
case WIFI_STANDARD_11AD:
|
||||
return "11ad";
|
||||
case WIFI_STANDARD_UNKNOWN:
|
||||
return "unknown";
|
||||
}
|
||||
@@ -705,6 +712,13 @@ public final class ScanResult implements Parcelable {
|
||||
return UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
if (band == WifiScanner.WIFI_BAND_60_GHZ) {
|
||||
if (channel >= BAND_60_GHZ_FIRST_CH_NUM && channel <= BAND_60_GHZ_LAST_CH_NUM) {
|
||||
return ((channel - BAND_60_GHZ_FIRST_CH_NUM) * 2160) + BAND_60_GHZ_START_FREQ_MHZ;
|
||||
} else {
|
||||
return UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
return UNSPECIFIED;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +115,11 @@ public final class SoftApCapability implements Parcelable {
|
||||
*/
|
||||
private int[] mSupportedChannelListIn6g = EMPTY_INT_ARRAY;
|
||||
|
||||
/**
|
||||
* A list storing supported 60G channels.
|
||||
*/
|
||||
private int[] mSupportedChannelListIn60g = EMPTY_INT_ARRAY;
|
||||
|
||||
/**
|
||||
* Get the maximum supported client numbers which AP resides on.
|
||||
*/
|
||||
@@ -147,8 +152,8 @@ public final class SoftApCapability implements Parcelable {
|
||||
* Set supported channel list in target band type.
|
||||
*
|
||||
* @param band One of the following band types:
|
||||
* {@link SoftApConfiguation#BAND_2GHZ}, {@link SoftApConfiguation#BAND_5GHZ} or
|
||||
* {@link SoftApConfiguation#BAND_6GHZ}.
|
||||
* {@link SoftApConfiguation#BAND_2GHZ}, {@link SoftApConfiguation#BAND_5GHZ},
|
||||
* {@link SoftApConfiguation#BAND_6GHZ}, or {@link SoftApConfiguation#BAND_60GHZ}.
|
||||
* @param supportedChannelList supported channel list in target band
|
||||
* @return true if band and supportedChannelList are valid, otherwise false.
|
||||
*
|
||||
@@ -168,6 +173,9 @@ public final class SoftApCapability implements Parcelable {
|
||||
case SoftApConfiguration.BAND_6GHZ:
|
||||
mSupportedChannelListIn6g = supportedChannelList;
|
||||
break;
|
||||
case SoftApConfiguration.BAND_60GHZ:
|
||||
mSupportedChannelListIn60g = supportedChannelList;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid band: " + band);
|
||||
}
|
||||
@@ -181,8 +189,8 @@ public final class SoftApCapability implements Parcelable {
|
||||
* {@link SoftapConfiguration.Builder#setChannel(int, int)} API.
|
||||
*
|
||||
* @param band One of the following band types:
|
||||
* {@link SoftApConfiguation#BAND_2GHZ}, {@link SoftApConfiguation#BAND_5GHZ} or
|
||||
* {@link SoftApConfiguation#BAND_6GHZ}.
|
||||
* {@link SoftApConfiguation#BAND_2GHZ}, {@link SoftApConfiguation#BAND_5GHZ},
|
||||
* {@link SoftApConfiguation#BAND_6GHZ}, {@link SoftApConfiguation#BAND_60GHZ}.
|
||||
* @return List of supported channels for the band.
|
||||
*
|
||||
* @throws IllegalArgumentException when band type is invalid.
|
||||
@@ -199,6 +207,8 @@ public final class SoftApCapability implements Parcelable {
|
||||
return mSupportedChannelListIn5g;
|
||||
case SoftApConfiguration.BAND_6GHZ:
|
||||
return mSupportedChannelListIn6g;
|
||||
case SoftApConfiguration.BAND_60GHZ:
|
||||
return mSupportedChannelListIn60g;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid band: " + band);
|
||||
}
|
||||
@@ -214,6 +224,7 @@ public final class SoftApCapability implements Parcelable {
|
||||
mSupportedChannelListIn24g = source.mSupportedChannelListIn24g;
|
||||
mSupportedChannelListIn5g = source.mSupportedChannelListIn5g;
|
||||
mSupportedChannelListIn6g = source.mSupportedChannelListIn6g;
|
||||
mSupportedChannelListIn60g = source.mSupportedChannelListIn60g;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +255,7 @@ public final class SoftApCapability implements Parcelable {
|
||||
dest.writeIntArray(mSupportedChannelListIn24g);
|
||||
dest.writeIntArray(mSupportedChannelListIn5g);
|
||||
dest.writeIntArray(mSupportedChannelListIn6g);
|
||||
dest.writeIntArray(mSupportedChannelListIn60g);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -255,6 +267,7 @@ public final class SoftApCapability implements Parcelable {
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_2GHZ, in.createIntArray());
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_5GHZ, in.createIntArray());
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_6GHZ, in.createIntArray());
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_60GHZ, in.createIntArray());
|
||||
return capability;
|
||||
}
|
||||
|
||||
@@ -273,6 +286,8 @@ public final class SoftApCapability implements Parcelable {
|
||||
.append(Arrays.toString(mSupportedChannelListIn24g));
|
||||
sbuf.append("SupportedChannelListIn5g").append(Arrays.toString(mSupportedChannelListIn5g));
|
||||
sbuf.append("SupportedChannelListIn6g").append(Arrays.toString(mSupportedChannelListIn6g));
|
||||
sbuf.append("SupportedChannelListIn60g")
|
||||
.append(Arrays.toString(mSupportedChannelListIn60g));
|
||||
return sbuf.toString();
|
||||
}
|
||||
|
||||
@@ -285,7 +300,8 @@ public final class SoftApCapability implements Parcelable {
|
||||
&& mMaximumSupportedClientNumber == capability.mMaximumSupportedClientNumber
|
||||
&& Arrays.equals(mSupportedChannelListIn24g, capability.mSupportedChannelListIn24g)
|
||||
&& Arrays.equals(mSupportedChannelListIn5g, capability.mSupportedChannelListIn5g)
|
||||
&& Arrays.equals(mSupportedChannelListIn6g, capability.mSupportedChannelListIn6g);
|
||||
&& Arrays.equals(mSupportedChannelListIn6g, capability.mSupportedChannelListIn6g)
|
||||
&& Arrays.equals(mSupportedChannelListIn60g, capability.mSupportedChannelListIn60g);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -293,6 +309,7 @@ public final class SoftApCapability implements Parcelable {
|
||||
return Objects.hash(mSupportedFeatures, mMaximumSupportedClientNumber,
|
||||
Arrays.hashCode(mSupportedChannelListIn24g),
|
||||
Arrays.hashCode(mSupportedChannelListIn5g),
|
||||
Arrays.hashCode(mSupportedChannelListIn6g));
|
||||
Arrays.hashCode(mSupportedChannelListIn6g),
|
||||
Arrays.hashCode(mSupportedChannelListIn60g));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,13 @@ public final class SoftApConfiguration implements Parcelable {
|
||||
@SystemApi
|
||||
public static final int BAND_6GHZ = 1 << 2;
|
||||
|
||||
/**
|
||||
* 60GHz band.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final int BAND_60GHZ = 1 << 3;
|
||||
|
||||
/**
|
||||
* Device is allowed to choose the optimal band (2Ghz, 5Ghz, 6Ghz) based on device capability,
|
||||
* operating country code and current radio conditions.
|
||||
@@ -104,11 +111,13 @@ public final class SoftApConfiguration implements Parcelable {
|
||||
BAND_2GHZ,
|
||||
BAND_5GHZ,
|
||||
BAND_6GHZ,
|
||||
BAND_60GHZ,
|
||||
})
|
||||
public @interface BandType {}
|
||||
|
||||
private static boolean isBandValid(@BandType int band) {
|
||||
return ((band != 0) && ((band & ~BAND_ANY) == 0));
|
||||
int bandAny = BAND_2GHZ | BAND_5GHZ | BAND_6GHZ | BAND_60GHZ;
|
||||
return ((band != 0) && ((band & ~bandAny) == 0));
|
||||
}
|
||||
|
||||
private static final int MIN_CH_2G_BAND = 1;
|
||||
@@ -117,6 +126,8 @@ public final class SoftApConfiguration implements Parcelable {
|
||||
private static final int MAX_CH_5G_BAND = 196;
|
||||
private static final int MIN_CH_6G_BAND = 1;
|
||||
private static final int MAX_CH_6G_BAND = 253;
|
||||
private static final int MIN_CH_60G_BAND = 1;
|
||||
private static final int MAX_CH_60G_BAND = 6;
|
||||
|
||||
|
||||
|
||||
@@ -139,6 +150,13 @@ public final class SoftApConfiguration implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case BAND_60GHZ:
|
||||
if (channel < MIN_CH_60G_BAND || channel > MAX_CH_60G_BAND) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,34 @@ public final class SoftApInfo implements Parcelable {
|
||||
*/
|
||||
public static final int CHANNEL_WIDTH_160MHZ = 6;
|
||||
|
||||
/**
|
||||
* AP Channel bandwidth is 2160 MHZ.
|
||||
*
|
||||
* @see #getBandwidth()
|
||||
*/
|
||||
public static final int CHANNEL_WIDTH_2160MHZ = 7;
|
||||
|
||||
/**
|
||||
* AP Channel bandwidth is 4320 MHZ.
|
||||
*
|
||||
* @see #getBandwidth()
|
||||
*/
|
||||
public static final int CHANNEL_WIDTH_4320MHZ = 8;
|
||||
|
||||
/**
|
||||
* AP Channel bandwidth is 6480 MHZ.
|
||||
*
|
||||
* @see #getBandwidth()
|
||||
*/
|
||||
public static final int CHANNEL_WIDTH_6480MHZ = 9;
|
||||
|
||||
/**
|
||||
* AP Channel bandwidth is 8640 MHZ.
|
||||
*
|
||||
* @see #getBandwidth()
|
||||
*/
|
||||
public static final int CHANNEL_WIDTH_8640MHZ = 10;
|
||||
|
||||
/** The frequency which AP resides on. */
|
||||
private int mFrequency = 0;
|
||||
|
||||
@@ -125,7 +153,9 @@ public final class SoftApInfo implements Parcelable {
|
||||
*
|
||||
* @return One of {@link #CHANNEL_WIDTH_20MHZ}, {@link #CHANNEL_WIDTH_40MHZ},
|
||||
* {@link #CHANNEL_WIDTH_80MHZ}, {@link #CHANNEL_WIDTH_160MHZ},
|
||||
* {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ} or {@link #CHANNEL_WIDTH_INVALID}.
|
||||
* {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ}, {@link #CHANNEL_WIDTH_2160MHZ},
|
||||
* {@link #CHANNEL_WIDTH_4320MHZ}, {@link #CHANNEL_WIDTH_6480MHZ},
|
||||
* {@link #CHANNEL_WIDTH_8640MHZ}, or {@link #CHANNEL_WIDTH_INVALID}.
|
||||
*/
|
||||
@WifiAnnotations.Bandwidth
|
||||
public int getBandwidth() {
|
||||
|
||||
@@ -57,6 +57,10 @@ public final class WifiAnnotations {
|
||||
SoftApInfo.CHANNEL_WIDTH_80MHZ,
|
||||
SoftApInfo.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
|
||||
SoftApInfo.CHANNEL_WIDTH_160MHZ,
|
||||
SoftApInfo.CHANNEL_WIDTH_2160MHZ,
|
||||
SoftApInfo.CHANNEL_WIDTH_4320MHZ,
|
||||
SoftApInfo.CHANNEL_WIDTH_6480MHZ,
|
||||
SoftApInfo.CHANNEL_WIDTH_8640MHZ,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Bandwidth {}
|
||||
@@ -77,6 +81,7 @@ public final class WifiAnnotations {
|
||||
ScanResult.WIFI_STANDARD_11N,
|
||||
ScanResult.WIFI_STANDARD_11AC,
|
||||
ScanResult.WIFI_STANDARD_11AX,
|
||||
ScanResult.WIFI_STANDARD_11AD,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface WifiStandard{}
|
||||
|
||||
@@ -42,10 +42,12 @@ public class SoftApCapabilityTest {
|
||||
| SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD;
|
||||
int[] testSupported2Glist = {1, 2, 3, 4};
|
||||
int[] testSupported5Glist = {36, 149};
|
||||
int[] testSupported60Glist = {1, 2};
|
||||
SoftApCapability capability = new SoftApCapability(testSoftApFeature);
|
||||
capability.setMaxSupportedClients(10);
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_2GHZ, testSupported2Glist);
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_5GHZ, testSupported5Glist);
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_60GHZ, testSupported60Glist);
|
||||
|
||||
SoftApCapability copiedCapability = new SoftApCapability(capability);
|
||||
|
||||
@@ -64,9 +66,11 @@ public class SoftApCapabilityTest {
|
||||
capability.setMaxSupportedClients(10);
|
||||
int[] testSupported2Glist = {1, 2, 3, 4};
|
||||
int[] testSupported5Glist = {36, 149};
|
||||
int[] testSupported60Glist = {1, 2};
|
||||
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_2GHZ, testSupported2Glist);
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_5GHZ, testSupported5Glist);
|
||||
capability.setSupportedChannelList(SoftApConfiguration.BAND_60GHZ, testSupported60Glist);
|
||||
|
||||
Parcel parcelW = Parcel.obtain();
|
||||
capability.writeToParcel(parcelW, 0);
|
||||
|
||||
@@ -519,4 +519,14 @@ public class SoftApConfigurationTest {
|
||||
}
|
||||
assertTrue(isIllegalArgumentExceptionHappened);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testInvalidConfigWhenSet60GhzChannels() throws Exception {
|
||||
SparseIntArray invalid_channels = new SparseIntArray();
|
||||
invalid_channels.put(SoftApConfiguration.BAND_60GHZ, 99);
|
||||
SoftApConfiguration config = new SoftApConfiguration.Builder()
|
||||
.setSsid("ssid")
|
||||
.setChannels(invalid_channels)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user