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

Commit 9eeba378 authored by Mitchell Wills's avatar Mitchell Wills
Browse files

Add a hidden anqp field to ScanResult

This allows ScanResults from WifiScanner to contain anqp data

Bug: 26525037
Change-Id: I54beb3c4e0b8bff06a8255d2dc53439941be3c66
parent a3fc54f0
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package android.net.wifi;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

/**
 * Describes information about a detected access point. In addition
@@ -299,6 +301,12 @@ public class ScanResult implements Parcelable {
        return freq > 4900 && freq < 5900;
    }

    /**
     *  @hide
     * anqp lines from supplicant BSS response
     */
    public List<String> anqpLines;

    /**
     *  @hide
     * storing the raw bytes of full result IEs
@@ -518,6 +526,15 @@ public class ScanResult implements Parcelable {
        } else {
            dest.writeInt(0);
        }

        if (anqpLines != null) {
            dest.writeInt(anqpLines.size());
            for (int i = 0; i < anqpLines.size(); i++) {
                dest.writeString(anqpLines.get(i));
            }
        } else {
            dest.writeInt(0);
        }
    }

    /** Implement the Parcelable interface {@hide} */
@@ -565,6 +582,14 @@ public class ScanResult implements Parcelable {
                        in.readByteArray(sr.informationElements[i].bytes);
                    }
                }

                n = in.readInt();
                if (n != 0) {
                    sr.anqpLines = new ArrayList<String>();
                    for (int i = 0; i < n; i++) {
                        sr.anqpLines.add(in.readString());
                    }
                }
                return sr;
            }