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

Commit 5082458b authored by Jimmy Chen's avatar Jimmy Chen Committed by Android (Google) Code Review
Browse files

Merge "softap: Add BAND_60GHZ to SoftApConfiguration"

parents c3f64a3f 8ffdecf3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+5 −0
Original line number Diff line number Diff line
@@ -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;
  }
+14 −0
Original line number Diff line number Diff line
@@ -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;
    }

+23 −6
Original line number Diff line number Diff line
@@ -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));
    }
}
+19 −1
Original line number Diff line number Diff line
@@ -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;
        }
Loading