diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java index 77f7b9e23fc08..b2930772c217a 100644 --- a/wifi/java/android/net/wifi/WifiScanner.java +++ b/wifi/java/android/net/wifi/WifiScanner.java @@ -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]; } }; - } /**