Wifi: Reorganize wifi bands definition

This CL reorganizes wifi bands definition to be represented as
a bit-mask rather than arbitrary values.
This is useful for making it scalable for adding new bands. This
is a prep step before adding 6GHz band support.

Bug: 139354972
Test: Manual
Change-Id: I95b359ed05d429abc81faa726bc6a282b3a3e329
This commit is contained in:
Ahmed ElArabawy
2019-11-07 10:13:56 -08:00
parent bbe62f41ab
commit 6c1f7010ac

View File

@@ -58,6 +58,60 @@ import java.util.concurrent.Executor;
@SystemService(Context.WIFI_SCANNING_SERVICE)
public class WifiScanner {
/** @hide */
public static final int WIFI_BAND_INDEX_24_GHZ = 0;
/** @hide */
public static final int WIFI_BAND_INDEX_5_GHZ = 1;
/** @hide */
public static final int WIFI_BAND_INDEX_5_GHZ_DFS_ONLY = 2;
/** @hide */
public static final int WIFI_BAND_COUNT = 3;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"WIFI_BAND_INDEX_"}, value = {
WIFI_BAND_INDEX_24_GHZ,
WIFI_BAND_INDEX_5_GHZ,
WIFI_BAND_INDEX_5_GHZ_DFS_ONLY})
public @interface WifiBandIndex {}
/** no band specified; use channel list instead */
public static final int WIFI_BAND_UNSPECIFIED = 0;
/** 2.4 GHz band */
public static final int WIFI_BAND_24_GHZ = 1 << WIFI_BAND_INDEX_24_GHZ;
/** 5 GHz band excluding DFS channels */
public static final int WIFI_BAND_5_GHZ = 1 << WIFI_BAND_INDEX_5_GHZ;
/** DFS channels from 5 GHz band only */
public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 1 << WIFI_BAND_INDEX_5_GHZ_DFS_ONLY;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"WIFI_BAND_"}, value = {
WIFI_BAND_UNSPECIFIED,
WIFI_BAND_24_GHZ,
WIFI_BAND_5_GHZ,
WIFI_BAND_5_GHZ_DFS_ONLY})
public @interface WifiBandBasic {}
/**
* Combination of bands
* Note that those are only the common band combinations,
* other combinations can be created by combining any of the basic bands above
*/
/** Both 2.4 GHz band and 5 GHz band; no DFS channels */
public static final int WIFI_BAND_BOTH = WIFI_BAND_24_GHZ | WIFI_BAND_5_GHZ;
/**
* 2.4Ghz band + DFS channels from 5 GHz band only
* @hide
*/
public static final int WIFI_BAND_24_GHZ_WITH_5GHZ_DFS =
WIFI_BAND_24_GHZ | WIFI_BAND_5_GHZ_DFS_ONLY;
/** 5 GHz band including DFS channels */
public static final int WIFI_BAND_5_GHZ_WITH_DFS = WIFI_BAND_5_GHZ | WIFI_BAND_5_GHZ_DFS_ONLY;
/** Both 2.4 GHz band and 5 GHz band; with DFS channels */
public static final int WIFI_BAND_BOTH_WITH_DFS =
WIFI_BAND_24_GHZ | WIFI_BAND_5_GHZ | WIFI_BAND_5_GHZ_DFS_ONLY;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"WIFI_BAND_"}, value = {
@@ -71,25 +125,6 @@ public class WifiScanner {
WIFI_BAND_BOTH_WITH_DFS})
public @interface WifiBand {}
/** no band specified; use channel list instead */
public static final int WIFI_BAND_UNSPECIFIED = 0;
/** 2.4 GHz band */
public static final int WIFI_BAND_24_GHZ = 1;
/** 5 GHz band excluding DFS channels */
public static final int WIFI_BAND_5_GHZ = 2;
/** Both 2.4 GHz band and 5 GHz band; no DFS channels */
public static final int WIFI_BAND_BOTH = 3;
/** DFS channels from 5 GHz band only */
public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4;
/**
* 2.4Ghz band + DFS channels from 5 GHz band only
* @hide
*/
public static final int WIFI_BAND_24_GHZ_WITH_5GHZ_DFS = 5;
/** 5 GHz band including DFS channels */
public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6;
/** Both 2.4 GHz band and 5 GHz band; with DFS channels */
public static final int WIFI_BAND_BOTH_WITH_DFS = 7;
/**
* Max band value
* @hide
@@ -398,7 +433,6 @@ public class WifiScanner {
return new ScanSettings[size];
}
};
}
/**