Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0a3555d authored by Jimmy Chen's avatar Jimmy Chen
Browse files

wifi: add support for 60GHz band in WifiScanner

Add new Wifi bands to include WIFI_BAND_60_GHZ.
WIFI_BAND_24_5_6_60_GHZ and WIFI_BAND_24_5_WITH_DFS_6_60_GHZ were
added and shall be used for performing full scan.

Add new addResults function which receives the full ScanData and
updates mBandScanned in addition to the scan results.
This function is used when consolidating scan results from
multiple interfaces, each one containing different bands.

isFullBandScanResults function was added and returns true in case
2.4GHz and 5GHz bands are included in the scan results, as scan results
from other bands may not be present.

Bug: 147495503
Test: Manual - enable wifi and connect to an access point
Test: atest FrameworksWifiTests
Test: atest FrameworksWifiApiTests
Change-Id: I907b9b3382a193ae17107fa48a50890cb45c8736
parent 7532b221
Loading
Loading
Loading
Loading

api/system-current.txt

100755 → 100644
+1 −0
Original line number Diff line number Diff line
@@ -7565,6 +7565,7 @@ package android.net.wifi {
    field public static final int WIFI_BAND_5_GHZ = 2; // 0x2
    field public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4; // 0x4
    field public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6; // 0x6
    field public static final int WIFI_BAND_60_GHZ = 16; // 0x10
    field public static final int WIFI_BAND_6_GHZ = 8; // 0x8
    field public static final int WIFI_BAND_BOTH = 3; // 0x3
    field public static final int WIFI_BAND_BOTH_WITH_DFS = 7; // 0x7
+1 −0
Original line number Diff line number Diff line
@@ -651,6 +651,7 @@ package android.net.wifi {
    field public static final int WIFI_BAND_5_GHZ = 2; // 0x2
    field public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4; // 0x4
    field public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6; // 0x6
    field public static final int WIFI_BAND_60_GHZ = 16; // 0x10
    field public static final int WIFI_BAND_6_GHZ = 8; // 0x8
    field public static final int WIFI_BAND_BOTH = 3; // 0x3
    field public static final int WIFI_BAND_BOTH_WITH_DFS = 7; // 0x7
+34 −4
Original line number Diff line number Diff line
@@ -68,7 +68,9 @@ public class WifiScanner {
    /** @hide */
    public static final int WIFI_BAND_INDEX_6_GHZ = 3;
    /** @hide */
    public static final int WIFI_BAND_COUNT = 4;
    public static final int WIFI_BAND_INDEX_60_GHZ = 4;
    /** @hide */
    public static final int WIFI_BAND_COUNT = 5;

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
@@ -76,7 +78,8 @@ public class WifiScanner {
            WIFI_BAND_INDEX_24_GHZ,
            WIFI_BAND_INDEX_5_GHZ,
            WIFI_BAND_INDEX_5_GHZ_DFS_ONLY,
            WIFI_BAND_INDEX_6_GHZ})
            WIFI_BAND_INDEX_6_GHZ,
            WIFI_BAND_INDEX_60_GHZ})
    public @interface WifiBandIndex {}

    /** no band specified; use channel list instead */
@@ -89,6 +92,8 @@ public class WifiScanner {
    public static final int WIFI_BAND_5_GHZ_DFS_ONLY  = 1 << WIFI_BAND_INDEX_5_GHZ_DFS_ONLY;
    /** 6 GHz band */
    public static final int WIFI_BAND_6_GHZ = 1 << WIFI_BAND_INDEX_6_GHZ;
    /** 60 GHz band */
    public static final int WIFI_BAND_60_GHZ = 1 << WIFI_BAND_INDEX_60_GHZ;

    /**
     * Combination of bands
@@ -113,6 +118,12 @@ public class WifiScanner {
    /** 2.4 GHz band and 5 GHz band; with DFS channels and 6 GHz */
    public static final int WIFI_BAND_24_5_WITH_DFS_6_GHZ =
            WIFI_BAND_BOTH_WITH_DFS | WIFI_BAND_6_GHZ;
    /** @hide */
    public static final int WIFI_BAND_24_5_6_60_GHZ =
            WIFI_BAND_24_5_6_GHZ | WIFI_BAND_60_GHZ;
    /** @hide */
    public static final int WIFI_BAND_24_5_WITH_DFS_6_60_GHZ =
            WIFI_BAND_24_5_6_60_GHZ | WIFI_BAND_5_GHZ_DFS_ONLY;

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
@@ -127,7 +138,10 @@ public class WifiScanner {
            WIFI_BAND_BOTH_WITH_DFS,
            WIFI_BAND_6_GHZ,
            WIFI_BAND_24_5_6_GHZ,
            WIFI_BAND_24_5_WITH_DFS_6_GHZ})
            WIFI_BAND_24_5_WITH_DFS_6_GHZ,
            WIFI_BAND_60_GHZ,
            WIFI_BAND_24_5_6_60_GHZ,
            WIFI_BAND_24_5_WITH_DFS_6_60_GHZ})
    public @interface WifiBand {}

    /**
@@ -179,7 +193,10 @@ public class WifiScanner {
     * @hide
     */
    public static boolean isFullBandScan(@WifiBand int bandScanned, boolean excludeDfs) {
        return (bandScanned | WIFI_BAND_6_GHZ | (excludeDfs ? WIFI_BAND_5_GHZ_DFS_ONLY : 0))
        // 5GHz DFS channel is part of 5GHz, mark 5GHz scanned as well.
        if ((bandScanned & WIFI_BAND_5_GHZ_DFS_ONLY) != 0) bandScanned |= WIFI_BAND_5_GHZ;
        return (bandScanned | WIFI_BAND_6_GHZ | WIFI_BAND_60_GHZ
                | (excludeDfs ? WIFI_BAND_5_GHZ_DFS_ONLY : 0))
                == WIFI_BAND_ALL;
    }

@@ -571,6 +588,19 @@ public class WifiScanner {
            }
        }

        /** {@hide} */
        public void addResults(@NonNull ScanData s) {
            mBandScanned |= s.mBandScanned;
            mFlags |= s.mFlags;
            addResults(s.getResults());
        }

        /** {@hide} */
        public boolean isFullBandScanResults() {
            return (mBandScanned & WifiScanner.WIFI_BAND_24_GHZ) != 0
                && (mBandScanned & WifiScanner.WIFI_BAND_5_GHZ) != 0;
        }

        /** Implement the Parcelable interface {@hide} */
        public int describeContents() {
            return 0;