diff options
Diffstat (limited to 'wifi/java/android/net/wifi/WifiInfo.java')
-rw-r--r-- | wifi/java/android/net/wifi/WifiInfo.java | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index 0127c630baa9..7eadd3b3d9e9 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -16,6 +16,7 @@ package android.net.wifi; +import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.Nullable; import android.annotation.SystemApi; @@ -27,6 +28,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.net.Inet4Address; import java.net.InetAddress; import java.net.UnknownHostException; @@ -34,7 +37,7 @@ import java.util.EnumMap; import java.util.Locale; /** - * Describes the state of any Wifi connection that is active or + * Describes the state of any Wi-Fi connection that is active or * is in the process of being set up. */ public class WifiInfo implements Parcelable { @@ -96,6 +99,47 @@ public class WifiInfo implements Parcelable { private int mRssi; /** + * Wi-Fi unknown technology + */ + public static final int WIFI_TECHNOLOGY_UNKNOWN = 0; + + /** + * Wi-Fi 802.11a/b/g + */ + public static final int WIFI_TECHNOLOGY_LEGACY = 1; + + /** + * Wi-Fi 802.11n + */ + public static final int WIFI_TECHNOLOGY_11N = 4; + + /** + * Wi-Fi 802.11ac + */ + public static final int WIFI_TECHNOLOGY_11AC = 5; + + /** + * Wi-Fi 802.11ax + */ + public static final int WIFI_TECHNOLOGY_11AX = 6; + + /** @hide */ + @IntDef(prefix = { "WIFI_TECHNOLOGY_" }, value = { + WIFI_TECHNOLOGY_UNKNOWN, + WIFI_TECHNOLOGY_LEGACY, + WIFI_TECHNOLOGY_11N, + WIFI_TECHNOLOGY_11AC, + WIFI_TECHNOLOGY_11AX + }) + @Retention(RetentionPolicy.SOURCE) + public @interface WifiTechnology{} + + /** + * Wi-Fi technology for the connection + */ + private @WifiTechnology int mWifiTechnology; + + /** * The unit in which links speeds are expressed. */ public static final String LINK_SPEED_UNITS = "Mbps"; @@ -301,6 +345,7 @@ public class WifiInfo implements Parcelable { txSuccessRate = source.txSuccessRate; rxSuccessRate = source.rxSuccessRate; score = source.score; + mWifiTechnology = source.mWifiTechnology; } } @@ -389,6 +434,22 @@ public class WifiInfo implements Parcelable { } /** + * Sets the Wi-Fi technology + * @hide + */ + public void setWifiTechnology(@WifiTechnology int wifiTechnology) { + mWifiTechnology = wifiTechnology; + } + + /** + * Get connection Wi-Fi technology + * @return the connection Wi-Fi technology + */ + public @WifiTechnology int getWifiTechnology() { + return mWifiTechnology; + } + + /** * Returns the current link speed in {@link #LINK_SPEED_UNITS}. * @return the link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown. * @see #LINK_SPEED_UNITS @@ -727,6 +788,7 @@ public class WifiInfo implements Parcelable { .append(", Wifi Generation: ").append(mWifiGeneration) .append(", TWT support: ").append(mTwtSupport) .append(", Eight Max VHT Spatial streams support: ").append(mVhtMax8SpatialStreamsSupport) + .append(", Wi-Fi technology: ").append(mWifiTechnology) .append(", RSSI: ").append(mRssi) .append(", Link speed: ").append(mLinkSpeed).append(LINK_SPEED_UNITS) .append(", Tx Link speed: ").append(mTxLinkSpeed).append(LINK_SPEED_UNITS) @@ -785,6 +847,7 @@ public class WifiInfo implements Parcelable { dest.writeInt(mWifiGeneration); dest.writeInt(mVhtMax8SpatialStreamsSupport ? 1 : 0); dest.writeInt(mTwtSupport ? 1 : 0); + dest.writeInt(mWifiTechnology); } /** Implement the Parcelable interface {@hide} */ @@ -829,6 +892,7 @@ public class WifiInfo implements Parcelable { info.mWifiGeneration = in.readInt(); info.mVhtMax8SpatialStreamsSupport = in.readInt() != 0; info.mTwtSupport = in.readInt() != 0; + info.mWifiTechnology = in.readInt(); return info; } |