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

Commit 08a23eb7 authored by Xiao Ma's avatar Xiao Ma Committed by Android (Google) Code Review
Browse files

Merge "Make Information Elements (IE) of a scan result available as a public API."

parents 071a05b6 8e5ca5cd
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -30557,7 +30557,9 @@ package android.net.wifi {
  }
  public class ScanResult implements android.os.Parcelable {
    ctor public ScanResult(@NonNull android.net.wifi.ScanResult);
    method public int describeContents();
    method @NonNull public java.util.List<android.net.wifi.ScanResult.InformationElement> getInformationElements();
    method public int getWifiStandard();
    method public boolean is80211mcResponder();
    method public boolean isPasspointNetwork();
@@ -30568,6 +30570,7 @@ package android.net.wifi {
    field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
    field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
    field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
    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_11AX = 6; // 0x6
@@ -30585,6 +30588,13 @@ package android.net.wifi {
    field public CharSequence venueName;
  }
  public static class ScanResult.InformationElement {
    ctor public ScanResult.InformationElement(@NonNull android.net.wifi.ScanResult.InformationElement);
    method @NonNull public java.nio.ByteBuffer getBytes();
    method public int getId();
    method public int getIdExt();
  }
  public final class SoftApConfiguration implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.net.MacAddress getBssid();
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@

package android.net.wifi;

parcelable ScanResult;
@JavaOnlyStableParcelable parcelable ScanResult;
+67 −12
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net.wifi;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
@@ -27,8 +28,10 @@ import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

@@ -576,67 +579,120 @@ public class ScanResult implements Parcelable {
    @UnsupportedAppUsage
    public List<String> anqpLines;

    /** information elements from beacon
     * @hide
    /**
     * information elements from beacon.
     */
    public static class InformationElement {
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_SSID = 0;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_SUPPORTED_RATES = 1;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_TIM = 5;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_BSS_LOAD = 11;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_ERP = 42;
        /** @hide */
        public static final int EID_HT_CAPABILITIES = 45;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_RSN = 48;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_EXTENDED_SUPPORTED_RATES = 50;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_HT_OPERATION = 61;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_INTERWORKING = 107;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_ROAMING_CONSORTIUM = 111;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_EXTENDED_CAPS = 127;
        /** @hide */
        public static final int EID_VHT_CAPABILITIES = 191;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_VHT_OPERATION = 192;
        /** @hide */
        @UnsupportedAppUsage
        public static final int EID_VSA = 221;
        /** @hide */
        public static final int EID_EXTENSION_PRESENT = 255;

        /**
         * Extension IDs
         */
        // Extension IDs
        /** @hide */
        public static final int EID_EXT_HE_CAPABILITIES = 35;
        /** @hide */
        public static final int EID_EXT_HE_OPERATION = 36;

        /** @hide */
        @UnsupportedAppUsage
        public int id;
        /** @hide */
        public int idExt;

        /** @hide */
        @UnsupportedAppUsage
        public byte[] bytes;

        /** @hide */
        public InformationElement() {
        }

        public InformationElement(InformationElement rhs) {
        public InformationElement(@NonNull InformationElement rhs) {
            this.id = rhs.id;
            this.idExt = rhs.idExt;
            this.bytes = rhs.bytes.clone();
        }

        /**
         * The element ID of the information element. Defined in the IEEE 802.11-2016 spec
         * Table 9-77.
         */
        public int getId() {
            return id;
        }

        /**
         * The element ID Extension of the information element. Defined in the IEEE 802.11-2016 spec
         * Table 9-77.
         */
        public int getIdExt() {
            return idExt;
        }

        /**
         * Get the specific content of the information element.
         */
        @NonNull
        public ByteBuffer getBytes() {
            return ByteBuffer.wrap(bytes).asReadOnlyBuffer();
        }
    }

    /** information elements found in the beacon
    /**
     * information elements found in the beacon.
     * @hide
     */
    @UnsupportedAppUsage
    public InformationElement[] informationElements;
    /**
     * Get all information elements found in the beacon.
     */
    @NonNull
    public List<InformationElement> getInformationElements() {
        return Collections.unmodifiableList(Arrays.asList(informationElements));
    }

    /** ANQP response elements.
     * @hide
@@ -762,8 +818,8 @@ public class ScanResult implements Parcelable {
        this.wifiSsid = wifiSsid;
    }

    /** copy constructor {@hide} */
    public ScanResult(ScanResult source) {
    /** copy constructor */
    public ScanResult(@NonNull ScanResult source) {
        if (source != null) {
            wifiSsid = source.wifiSsid;
            SSID = source.SSID;
@@ -929,9 +985,8 @@ public class ScanResult implements Parcelable {
        }
    }

    /** Implement the Parcelable interface {@hide} */
    @UnsupportedAppUsage
    public static final @android.annotation.NonNull Creator<ScanResult> CREATOR =
    /** Implement the Parcelable interface */
    public static final @NonNull Creator<ScanResult> CREATOR =
        new Creator<ScanResult>() {
            public ScanResult createFromParcel(Parcel in) {
                WifiSsid wifiSsid = null;