Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -30626,6 +30626,8 @@ package android.net.wifi { method public int getIpAddress(); method public int getLinkSpeed(); method public String getMacAddress(); method public int getMaxSupportedRxLinkSpeedMbps(); method public int getMaxSupportedTxLinkSpeedMbps(); method public int getNetworkId(); method @Nullable public String getPasspointFqdn(); method @Nullable public String getPasspointProviderFriendlyName(); wifi/java/android/net/wifi/WifiInfo.java +56 −0 Original line number Diff line number Diff line Loading @@ -123,11 +123,21 @@ public class WifiInfo implements Parcelable { */ private int mTxLinkSpeed; /** * Max supported Tx(transmit) link speed in Mbps */ private int mMaxSupportedTxLinkSpeed; /** * Rx(receive) Link speed in Mbps */ private int mRxLinkSpeed; /** * Max supported Rx(receive) link speed in Mbps */ private int mMaxSupportedRxLinkSpeed; /** * Frequency in MHz */ Loading Loading @@ -303,6 +313,8 @@ public class WifiInfo implements Parcelable { setLinkSpeed(LINK_SPEED_UNKNOWN); setTxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setRxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setMaxSupportedTxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setMaxSupportedRxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setFrequency(-1); setMeteredHint(false); setEphemeral(false); Loading Loading @@ -356,6 +368,8 @@ public class WifiInfo implements Parcelable { mRxSuccessRate = source.mRxSuccessRate; score = source.score; mWifiStandard = source.mWifiStandard; mMaxSupportedTxLinkSpeed = source.mMaxSupportedTxLinkSpeed; mMaxSupportedRxLinkSpeed = source.mMaxSupportedRxLinkSpeed; } } Loading Loading @@ -551,6 +565,15 @@ public class WifiInfo implements Parcelable { return mTxLinkSpeed; } /** * Returns the maximum supported transmit link speed in Mbps * @return the max supported tx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is * unknown. @see #LINK_SPEED_UNKNOWN */ public int getMaxSupportedTxLinkSpeedMbps() { return mMaxSupportedTxLinkSpeed; } /** * Update the last transmitted packet bit rate in Mbps. * @hide Loading @@ -559,6 +582,14 @@ public class WifiInfo implements Parcelable { mTxLinkSpeed = txLinkSpeed; } /** * Set the maximum supported transmit link speed in Mbps * @hide */ public void setMaxSupportedTxLinkSpeedMbps(int maxSupportedTxLinkSpeed) { mMaxSupportedTxLinkSpeed = maxSupportedTxLinkSpeed; } /** * Returns the current receive link speed in Mbps. * @return the Rx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown. Loading @@ -569,6 +600,15 @@ public class WifiInfo implements Parcelable { return mRxLinkSpeed; } /** * Returns the maximum supported receive link speed in Mbps * @return the max supported Rx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is * unknown. @see #LINK_SPEED_UNKNOWN */ public int getMaxSupportedRxLinkSpeedMbps() { return mMaxSupportedRxLinkSpeed; } /** * Update the last received packet bit rate in Mbps. * @hide Loading @@ -577,6 +617,14 @@ public class WifiInfo implements Parcelable { mRxLinkSpeed = rxLinkSpeed; } /** * Set the maximum supported receive link speed in Mbps * @hide */ public void setMaxSupportedRxLinkSpeedMbps(int maxSupportedRxLinkSpeed) { mMaxSupportedRxLinkSpeed = maxSupportedRxLinkSpeed; } /** * Returns the current frequency in {@link #FREQUENCY_UNITS}. * @return the frequency. Loading Loading @@ -864,7 +912,11 @@ public class WifiInfo implements Parcelable { .append(", RSSI: ").append(mRssi) .append(", Link speed: ").append(mLinkSpeed).append(LINK_SPEED_UNITS) .append(", Tx Link speed: ").append(mTxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Max Supported Tx Link speed: ") .append(mMaxSupportedTxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Rx Link speed: ").append(mRxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Max Supported Rx Link speed: ") .append(mMaxSupportedRxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Frequency: ").append(mFrequency).append(FREQUENCY_UNITS) .append(", Net ID: ").append(mNetworkId) .append(", Metered hint: ").append(mMeteredHint) Loading Loading @@ -917,6 +969,8 @@ public class WifiInfo implements Parcelable { dest.writeString(mFqdn); dest.writeString(mProviderFriendlyName); dest.writeInt(mWifiStandard); dest.writeInt(mMaxSupportedTxLinkSpeed); dest.writeInt(mMaxSupportedRxLinkSpeed); } /** Implement the Parcelable interface {@hide} */ Loading Loading @@ -959,6 +1013,8 @@ public class WifiInfo implements Parcelable { info.mFqdn = in.readString(); info.mProviderFriendlyName = in.readString(); info.mWifiStandard = in.readInt(); info.mMaxSupportedTxLinkSpeed = in.readInt(); info.mMaxSupportedRxLinkSpeed = in.readInt(); return info; } Loading wifi/tests/src/android/net/wifi/WifiInfoTest.java +25 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ public class WifiInfoTest { private static final String TEST_FQDN = "test.com"; private static final String TEST_PROVIDER_NAME = "test"; private static final int TEST_WIFI_STANDARD = ScanResult.WIFI_STANDARD_11AC; private static final int TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS = 866; private static final int TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS = 1200; /** * Verify parcel write/read with WifiInfo. Loading @@ -56,6 +58,8 @@ public class WifiInfoTest { writeWifiInfo.setProviderFriendlyName(TEST_PROVIDER_NAME); writeWifiInfo.setAppPackageName(TEST_PACKAGE_NAME); writeWifiInfo.setWifiStandard(TEST_WIFI_STANDARD); writeWifiInfo.setMaxSupportedTxLinkSpeedMbps(TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS); writeWifiInfo.setMaxSupportedRxLinkSpeedMbps(TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS); Parcel parcel = Parcel.obtain(); writeWifiInfo.writeToParcel(parcel, 0); Loading @@ -75,5 +79,26 @@ public class WifiInfoTest { assertEquals(TEST_FQDN, readWifiInfo.getPasspointFqdn()); assertEquals(TEST_PROVIDER_NAME, readWifiInfo.getPasspointProviderFriendlyName()); assertEquals(TEST_WIFI_STANDARD, readWifiInfo.getWifiStandard()); assertEquals(TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS, readWifiInfo.getMaxSupportedTxLinkSpeedMbps()); assertEquals(TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS, readWifiInfo.getMaxSupportedRxLinkSpeedMbps()); } /** * Verify values after reset() */ @Test public void testWifiInfoResetValue() throws Exception { WifiInfo wifiInfo = new WifiInfo(); wifiInfo.reset(); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getMaxSupportedTxLinkSpeedMbps()); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getMaxSupportedRxLinkSpeedMbps()); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getTxLinkSpeedMbps()); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getRxLinkSpeedMbps()); assertEquals(WifiInfo.INVALID_RSSI, wifiInfo.getRssi()); assertEquals(WifiManager.UNKNOWN_SSID, wifiInfo.getSSID()); assertEquals(null, wifiInfo.getBSSID()); assertEquals(-1, wifiInfo.getNetworkId()); } } Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -30626,6 +30626,8 @@ package android.net.wifi { method public int getIpAddress(); method public int getLinkSpeed(); method public String getMacAddress(); method public int getMaxSupportedRxLinkSpeedMbps(); method public int getMaxSupportedTxLinkSpeedMbps(); method public int getNetworkId(); method @Nullable public String getPasspointFqdn(); method @Nullable public String getPasspointProviderFriendlyName();
wifi/java/android/net/wifi/WifiInfo.java +56 −0 Original line number Diff line number Diff line Loading @@ -123,11 +123,21 @@ public class WifiInfo implements Parcelable { */ private int mTxLinkSpeed; /** * Max supported Tx(transmit) link speed in Mbps */ private int mMaxSupportedTxLinkSpeed; /** * Rx(receive) Link speed in Mbps */ private int mRxLinkSpeed; /** * Max supported Rx(receive) link speed in Mbps */ private int mMaxSupportedRxLinkSpeed; /** * Frequency in MHz */ Loading Loading @@ -303,6 +313,8 @@ public class WifiInfo implements Parcelable { setLinkSpeed(LINK_SPEED_UNKNOWN); setTxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setRxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setMaxSupportedTxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setMaxSupportedRxLinkSpeedMbps(LINK_SPEED_UNKNOWN); setFrequency(-1); setMeteredHint(false); setEphemeral(false); Loading Loading @@ -356,6 +368,8 @@ public class WifiInfo implements Parcelable { mRxSuccessRate = source.mRxSuccessRate; score = source.score; mWifiStandard = source.mWifiStandard; mMaxSupportedTxLinkSpeed = source.mMaxSupportedTxLinkSpeed; mMaxSupportedRxLinkSpeed = source.mMaxSupportedRxLinkSpeed; } } Loading Loading @@ -551,6 +565,15 @@ public class WifiInfo implements Parcelable { return mTxLinkSpeed; } /** * Returns the maximum supported transmit link speed in Mbps * @return the max supported tx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is * unknown. @see #LINK_SPEED_UNKNOWN */ public int getMaxSupportedTxLinkSpeedMbps() { return mMaxSupportedTxLinkSpeed; } /** * Update the last transmitted packet bit rate in Mbps. * @hide Loading @@ -559,6 +582,14 @@ public class WifiInfo implements Parcelable { mTxLinkSpeed = txLinkSpeed; } /** * Set the maximum supported transmit link speed in Mbps * @hide */ public void setMaxSupportedTxLinkSpeedMbps(int maxSupportedTxLinkSpeed) { mMaxSupportedTxLinkSpeed = maxSupportedTxLinkSpeed; } /** * Returns the current receive link speed in Mbps. * @return the Rx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown. Loading @@ -569,6 +600,15 @@ public class WifiInfo implements Parcelable { return mRxLinkSpeed; } /** * Returns the maximum supported receive link speed in Mbps * @return the max supported Rx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is * unknown. @see #LINK_SPEED_UNKNOWN */ public int getMaxSupportedRxLinkSpeedMbps() { return mMaxSupportedRxLinkSpeed; } /** * Update the last received packet bit rate in Mbps. * @hide Loading @@ -577,6 +617,14 @@ public class WifiInfo implements Parcelable { mRxLinkSpeed = rxLinkSpeed; } /** * Set the maximum supported receive link speed in Mbps * @hide */ public void setMaxSupportedRxLinkSpeedMbps(int maxSupportedRxLinkSpeed) { mMaxSupportedRxLinkSpeed = maxSupportedRxLinkSpeed; } /** * Returns the current frequency in {@link #FREQUENCY_UNITS}. * @return the frequency. Loading Loading @@ -864,7 +912,11 @@ public class WifiInfo implements Parcelable { .append(", RSSI: ").append(mRssi) .append(", Link speed: ").append(mLinkSpeed).append(LINK_SPEED_UNITS) .append(", Tx Link speed: ").append(mTxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Max Supported Tx Link speed: ") .append(mMaxSupportedTxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Rx Link speed: ").append(mRxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Max Supported Rx Link speed: ") .append(mMaxSupportedRxLinkSpeed).append(LINK_SPEED_UNITS) .append(", Frequency: ").append(mFrequency).append(FREQUENCY_UNITS) .append(", Net ID: ").append(mNetworkId) .append(", Metered hint: ").append(mMeteredHint) Loading Loading @@ -917,6 +969,8 @@ public class WifiInfo implements Parcelable { dest.writeString(mFqdn); dest.writeString(mProviderFriendlyName); dest.writeInt(mWifiStandard); dest.writeInt(mMaxSupportedTxLinkSpeed); dest.writeInt(mMaxSupportedRxLinkSpeed); } /** Implement the Parcelable interface {@hide} */ Loading Loading @@ -959,6 +1013,8 @@ public class WifiInfo implements Parcelable { info.mFqdn = in.readString(); info.mProviderFriendlyName = in.readString(); info.mWifiStandard = in.readInt(); info.mMaxSupportedTxLinkSpeed = in.readInt(); info.mMaxSupportedRxLinkSpeed = in.readInt(); return info; } Loading
wifi/tests/src/android/net/wifi/WifiInfoTest.java +25 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ public class WifiInfoTest { private static final String TEST_FQDN = "test.com"; private static final String TEST_PROVIDER_NAME = "test"; private static final int TEST_WIFI_STANDARD = ScanResult.WIFI_STANDARD_11AC; private static final int TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS = 866; private static final int TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS = 1200; /** * Verify parcel write/read with WifiInfo. Loading @@ -56,6 +58,8 @@ public class WifiInfoTest { writeWifiInfo.setProviderFriendlyName(TEST_PROVIDER_NAME); writeWifiInfo.setAppPackageName(TEST_PACKAGE_NAME); writeWifiInfo.setWifiStandard(TEST_WIFI_STANDARD); writeWifiInfo.setMaxSupportedTxLinkSpeedMbps(TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS); writeWifiInfo.setMaxSupportedRxLinkSpeedMbps(TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS); Parcel parcel = Parcel.obtain(); writeWifiInfo.writeToParcel(parcel, 0); Loading @@ -75,5 +79,26 @@ public class WifiInfoTest { assertEquals(TEST_FQDN, readWifiInfo.getPasspointFqdn()); assertEquals(TEST_PROVIDER_NAME, readWifiInfo.getPasspointProviderFriendlyName()); assertEquals(TEST_WIFI_STANDARD, readWifiInfo.getWifiStandard()); assertEquals(TEST_MAX_SUPPORTED_TX_LINK_SPEED_MBPS, readWifiInfo.getMaxSupportedTxLinkSpeedMbps()); assertEquals(TEST_MAX_SUPPORTED_RX_LINK_SPEED_MBPS, readWifiInfo.getMaxSupportedRxLinkSpeedMbps()); } /** * Verify values after reset() */ @Test public void testWifiInfoResetValue() throws Exception { WifiInfo wifiInfo = new WifiInfo(); wifiInfo.reset(); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getMaxSupportedTxLinkSpeedMbps()); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getMaxSupportedRxLinkSpeedMbps()); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getTxLinkSpeedMbps()); assertEquals(WifiInfo.LINK_SPEED_UNKNOWN, wifiInfo.getRxLinkSpeedMbps()); assertEquals(WifiInfo.INVALID_RSSI, wifiInfo.getRssi()); assertEquals(WifiManager.UNKNOWN_SSID, wifiInfo.getSSID()); assertEquals(null, wifiInfo.getBSSID()); assertEquals(-1, wifiInfo.getNetworkId()); } }