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

Commit 70a415e7 authored by Felipe Leme's avatar Felipe Leme
Browse files

Added support for WiFi frequency on WifiInfo (getter, settter, and frequency constant).

Bug: 12767819

Change-Id: Ib4a03919d9100861e993c733b7e478dc93dffaae
parent 80ddc855
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -15384,6 +15384,7 @@ package android.net.wifi {
    method public int describeContents();
    method public java.lang.String getBSSID();
    method public static android.net.NetworkInfo.DetailedState getDetailedStateOf(android.net.wifi.SupplicantState);
    method public int getFrequency();
    method public boolean getHiddenSSID();
    method public int getIpAddress();
    method public int getLinkSpeed();
@@ -15393,6 +15394,7 @@ package android.net.wifi {
    method public java.lang.String getSSID();
    method public android.net.wifi.SupplicantState getSupplicantState();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final java.lang.String FREQUENCY_UNITS = "MHz";
    field public static final java.lang.String LINK_SPEED_UNITS = "Mbps";
  }
@@ -18362,7 +18364,7 @@ package android.os {
  public abstract class CountDownTimer {
    ctor public CountDownTimer(long, long);
    method public final void cancel();
    method public final synchronized void cancel();
    method public abstract void onFinish();
    method public abstract void onTick(long);
    method public final synchronized android.os.CountDownTimer start();
+24 −1
Original line number Diff line number Diff line
@@ -69,6 +69,10 @@ public class WifiInfo implements Parcelable {
    public static final String LINK_SPEED_UNITS = "Mbps";
    private int mLinkSpeed;

    /** Frequency in MHz */
    public static final String FREQUENCY_UNITS = "MHz";
    private int mFrequency;

    private InetAddress mIpAddress;
    private String mMacAddress;

@@ -86,6 +90,7 @@ public class WifiInfo implements Parcelable {
        mSupplicantState = SupplicantState.UNINITIALIZED;
        mRssi = -9999;
        mLinkSpeed = -1;
        mFrequency = -1;
    }

    /**
@@ -100,6 +105,7 @@ public class WifiInfo implements Parcelable {
            mNetworkId = source.mNetworkId;
            mRssi = source.mRssi;
            mLinkSpeed = source.mLinkSpeed;
            mFrequency = source.mFrequency;
            mIpAddress = source.mIpAddress;
            mMacAddress = source.mMacAddress;
            mMeteredHint = source.mMeteredHint;
@@ -178,6 +184,20 @@ public class WifiInfo implements Parcelable {
        this.mLinkSpeed = linkSpeed;
    }

    /**
     * Returns the current frequency in {@link #FREQUENCY_UNITS}.
     * @return the frequency.
     * @see #FREQUENCY_UNITS
     */
    public int getFrequency() {
        return mFrequency;
    }

    /** @hide */
    public void setFrequency(int frequency) {
        this.mFrequency = frequency;
    }

    /**
     * Record the MAC address of the WLAN interface
     * @param macAddress the MAC address in {@code XX:XX:XX:XX:XX:XX} form
@@ -303,7 +323,8 @@ public class WifiInfo implements Parcelable {
            append(", Supplicant state: ").
            append(mSupplicantState == null ? none : mSupplicantState).
            append(", RSSI: ").append(mRssi).
            append(", Link speed: ").append(mLinkSpeed).
            append(", Link speed: ").append(mLinkSpeed).append(LINK_SPEED_UNITS).
            append(", Frequency: ").append(mFrequency).append(FREQUENCY_UNITS).
            append(", Net ID: ").append(mNetworkId).
            append(", Metered hint: ").append(mMeteredHint);

@@ -320,6 +341,7 @@ public class WifiInfo implements Parcelable {
        dest.writeInt(mNetworkId);
        dest.writeInt(mRssi);
        dest.writeInt(mLinkSpeed);
        dest.writeInt(mFrequency);
        if (mIpAddress != null) {
            dest.writeByte((byte)1);
            dest.writeByteArray(mIpAddress.getAddress());
@@ -346,6 +368,7 @@ public class WifiInfo implements Parcelable {
                info.setNetworkId(in.readInt());
                info.setRssi(in.readInt());
                info.setLinkSpeed(in.readInt());
                info.setFrequency(in.readInt());
                if (in.readByte() == 1) {
                    try {
                        info.setInetAddress(InetAddress.getByAddress(in.createByteArray()));