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

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

wifi: add basic support for 60GHz band

Add ScanResult.is60GHz() helper function which returns true if the frequency
belongs to the 60GHz band.

Add scans60GHz for additional scan info shown when Wifi verbose logging is
enabled.

Add definition of AP_BAND_60GHZ that is used for 60GHz SoftAP.

Bug: 145337375
Test: Manual - enable wifi and connect to an access point
Test: atest FrameworksWifiTests
Test: atest FrameworksWifiApiTests
Change-Id: Ie616bb815a27c053bec0c1056616be6123822be6
parent bad7e187
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -116,6 +116,16 @@ public class AccessPoint implements Comparable<AccessPoint> {
     */
    public static final int HIGHER_FREQ_5GHZ = 5900;

    /**
     * Lower bound on the 60 GHz (802.11ad) WIGIG channels
     */
    public static final int LOWER_FREQ_60GHZ = 58320;

    /**
     * Upper bound on the 60 GHz (802.11ad) WIGIG channels
     */
    public static final int HIGHER_FREQ_60GHZ = 70200;

    /** The key which identifies this AccessPoint grouping. */
    private String mKey;

+24 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ public class WifiUtils {
        StringBuilder visibility = new StringBuilder();
        StringBuilder scans24GHz = new StringBuilder();
        StringBuilder scans5GHz = new StringBuilder();
        StringBuilder scans60GHz = new StringBuilder();
        String bssid = null;

        if (accessPoint.isActive() && info != null) {
@@ -115,9 +116,11 @@ public class WifiUtils {

        int maxRssi5 = INVALID_RSSI;
        int maxRssi24 = INVALID_RSSI;
        int maxRssi60 = INVALID_RSSI;
        final int maxDisplayedScans = 4;
        int num5 = 0; // number of scanned BSSID on 5GHz band
        int num24 = 0; // number of scanned BSSID on 2.4Ghz band
        int num60 = 0; // number of scanned BSSID on 60Ghz band
        int numBlockListed = 0;

        // TODO: sort list by RSSI or age
@@ -152,6 +155,19 @@ public class WifiUtils {
                            verboseScanResultSummary(accessPoint, result, bssid,
                                    nowMs));
                }
            } else if (result.frequency >= AccessPoint.LOWER_FREQ_60GHZ
                    && result.frequency <= AccessPoint.HIGHER_FREQ_60GHZ) {
                // Strictly speaking: [60000, 61000]
                num60++;

                if (result.level > maxRssi60) {
                    maxRssi60 = result.level;
                }
                if (num60 <= maxDisplayedScans) {
                    scans60GHz.append(
                            verboseScanResultSummary(accessPoint, result, bssid,
                                    nowMs));
                }
            }
        }
        visibility.append(" [");
@@ -170,6 +186,14 @@ public class WifiUtils {
            }
            visibility.append(scans5GHz.toString());
        }
        visibility.append(";");
        if (num60 > 0) {
            visibility.append("(").append(num60).append(")");
            if (num60 > maxDisplayedScans) {
                visibility.append("max=").append(maxRssi60).append(",");
            }
            visibility.append(scans60GHz.toString());
        }
        if (numBlockListed > 0) {
            visibility.append("!").append(numBlockListed);
        }
+39 −0
Original line number Diff line number Diff line
@@ -594,6 +594,27 @@ public final class ScanResult implements Parcelable {
     */
    public static final int BAND_6_GHZ_END_FREQ_MHZ = 7105;

    /**
     * 60 GHz band first channel number
     * @hide
     */
    public static final int BAND_60_GHZ_FIRST_CH_NUM = 1;
    /**
     * 60 GHz band last channel number
     * @hide
     */
    public static final int BAND_60_GHZ_LAST_CH_NUM = 6;
    /**
     * 60 GHz band frequency of first channel in MHz
     * @hide
     */
    public static final int BAND_60_GHZ_START_FREQ_MHZ = 58320;
    /**
     * 60 GHz band frequency of last channel in MHz
     * @hide
     */
    public static final int BAND_60_GHZ_END_FREQ_MHZ = 70200;

    /**
     * Utility function to check if a frequency within 2.4 GHz band
     * @param freqMhz frequency in MHz
@@ -627,6 +648,17 @@ public final class ScanResult implements Parcelable {
        return freqMhz >= BAND_6_GHZ_START_FREQ_MHZ && freqMhz <= BAND_6_GHZ_END_FREQ_MHZ;
    }

    /**
     * Utility function to check if a frequency within 60 GHz band
     * @param freqMhz
     * @return true if within 60GHz, false otherwise
     *
     * @hide
     */
    public static boolean is60GHz(int freqMhz) {
        return freqMhz >= BAND_60_GHZ_START_FREQ_MHZ && freqMhz <= BAND_60_GHZ_END_FREQ_MHZ;
    }

    /**
     * Utility function to convert channel number/band to frequency in MHz
     * @param channel number to convert
@@ -706,6 +738,13 @@ public final class ScanResult implements Parcelable {
        return ScanResult.is6GHz(frequency);
    }

    /**
     * @hide
     */
    public boolean is60GHz() {
        return ScanResult.is60GHz(frequency);
    }

    /**
     *  @hide
     * anqp lines from supplicant BSS response
+6 −0
Original line number Diff line number Diff line
@@ -595,6 +595,12 @@ public class WifiConfiguration implements Parcelable {
     */
    public static final int AP_BAND_5GHZ = 1;

    /**
     * 60GHz band
     * @hide
     */
    public static final int AP_BAND_60GHZ = 2;

    /**
     * Device is allowed to choose the optimal band (2Ghz or 5Ghz) based on device capability,
     * operating country code and current radio conditions.