Merge "Wifi: Add some interface annotations" into rvc-dev am: 30caf3d28a am: 27e865a35e am: e8f54f8ad6
Change-Id: I7bd3c49b10e17226ad977c0c3d29218a2ed0894d
This commit is contained in:
@@ -7815,9 +7815,6 @@ package android.net.wifi.nl80211 {
|
|||||||
method public int getMaxNumberTxSpatialStreams();
|
method public int getMaxNumberTxSpatialStreams();
|
||||||
method public boolean isChannelWidthSupported(int);
|
method public boolean isChannelWidthSupported(int);
|
||||||
method public boolean isWifiStandardSupported(int);
|
method public boolean isWifiStandardSupported(int);
|
||||||
method public void setChannelWidthSupported(int, boolean);
|
|
||||||
method public void setMaxNumberRxSpatialStreams(int);
|
|
||||||
method public void setMaxNumberTxSpatialStreams(int);
|
|
||||||
method public void setWifiStandardSupport(int, boolean);
|
method public void setWifiStandardSupport(int, boolean);
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.nl80211.DeviceWiphyCapabilities> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.nl80211.DeviceWiphyCapabilities> CREATOR;
|
||||||
|
|||||||
@@ -16,16 +16,15 @@
|
|||||||
|
|
||||||
package android.net.wifi;
|
package android.net.wifi;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
|
import android.net.wifi.WifiAnnotations.ChannelWidth;
|
||||||
|
import android.net.wifi.WifiAnnotations.WifiStandard;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -313,17 +312,6 @@ public class ScanResult implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static final int WIFI_STANDARD_11AX = 6;
|
public static final int WIFI_STANDARD_11AX = 6;
|
||||||
|
|
||||||
/** @hide */
|
|
||||||
@IntDef(prefix = { "WIFI_STANDARD_" }, value = {
|
|
||||||
WIFI_STANDARD_UNKNOWN,
|
|
||||||
WIFI_STANDARD_LEGACY,
|
|
||||||
WIFI_STANDARD_11N,
|
|
||||||
WIFI_STANDARD_11AC,
|
|
||||||
WIFI_STANDARD_11AX
|
|
||||||
})
|
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
|
||||||
public @interface WifiStandard{}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AP wifi standard.
|
* AP wifi standard.
|
||||||
*/
|
*/
|
||||||
@@ -368,7 +356,7 @@ public class ScanResult implements Parcelable {
|
|||||||
* {@link #CHANNEL_WIDTH_80MHZ}, {@link #CHANNEL_WIDTH_160MHZ}
|
* {@link #CHANNEL_WIDTH_80MHZ}, {@link #CHANNEL_WIDTH_160MHZ}
|
||||||
* or {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ}.
|
* or {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ}.
|
||||||
*/
|
*/
|
||||||
public int channelWidth;
|
public @ChannelWidth int channelWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not used if the AP bandwidth is 20 MHz
|
* Not used if the AP bandwidth is 20 MHz
|
||||||
|
|||||||
@@ -61,6 +61,26 @@ public final class WifiAnnotations {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Bandwidth {}
|
public @interface Bandwidth {}
|
||||||
|
|
||||||
|
@IntDef(prefix = { "CHANNEL_WIDTH_" }, value = {
|
||||||
|
ScanResult.CHANNEL_WIDTH_20MHZ,
|
||||||
|
ScanResult.CHANNEL_WIDTH_40MHZ,
|
||||||
|
ScanResult.CHANNEL_WIDTH_80MHZ,
|
||||||
|
ScanResult.CHANNEL_WIDTH_160MHZ,
|
||||||
|
ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
|
||||||
|
})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
public @interface ChannelWidth{}
|
||||||
|
|
||||||
|
@IntDef(prefix = { "WIFI_STANDARD_" }, value = {
|
||||||
|
ScanResult.WIFI_STANDARD_UNKNOWN,
|
||||||
|
ScanResult.WIFI_STANDARD_LEGACY,
|
||||||
|
ScanResult.WIFI_STANDARD_11N,
|
||||||
|
ScanResult.WIFI_STANDARD_11AC,
|
||||||
|
ScanResult.WIFI_STANDARD_11AX,
|
||||||
|
})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
public @interface WifiStandard{}
|
||||||
|
|
||||||
@IntDef(prefix = { "PROTOCOL_" }, value = {
|
@IntDef(prefix = { "PROTOCOL_" }, value = {
|
||||||
ScanResult.PROTOCOL_NONE,
|
ScanResult.PROTOCOL_NONE,
|
||||||
ScanResult.PROTOCOL_WPA,
|
ScanResult.PROTOCOL_WPA,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class WifiInfo implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Wi-Fi standard for the connection
|
* Wi-Fi standard for the connection
|
||||||
*/
|
*/
|
||||||
private @ScanResult.WifiStandard int mWifiStandard;
|
private @WifiAnnotations.WifiStandard int mWifiStandard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unit in which links speeds are expressed.
|
* The unit in which links speeds are expressed.
|
||||||
@@ -518,7 +518,7 @@ public class WifiInfo implements Parcelable {
|
|||||||
* Sets the Wi-Fi standard
|
* Sets the Wi-Fi standard
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setWifiStandard(@ScanResult.WifiStandard int wifiStandard) {
|
public void setWifiStandard(@WifiAnnotations.WifiStandard int wifiStandard) {
|
||||||
mWifiStandard = wifiStandard;
|
mWifiStandard = wifiStandard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ public class WifiInfo implements Parcelable {
|
|||||||
* Get connection Wi-Fi standard
|
* Get connection Wi-Fi standard
|
||||||
* @return the connection Wi-Fi standard
|
* @return the connection Wi-Fi standard
|
||||||
*/
|
*/
|
||||||
public @ScanResult.WifiStandard int getWifiStandard() {
|
public @WifiAnnotations.WifiStandard int getWifiStandard() {
|
||||||
return mWifiStandard;
|
return mWifiStandard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2563,7 +2563,7 @@ public class WifiManager {
|
|||||||
* valid values from {@link ScanResult}'s {@code WIFI_STANDARD_}
|
* valid values from {@link ScanResult}'s {@code WIFI_STANDARD_}
|
||||||
* @return {@code true} if supported, {@code false} otherwise.
|
* @return {@code true} if supported, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isWifiStandardSupported(@ScanResult.WifiStandard int standard) {
|
public boolean isWifiStandardSupported(@WifiAnnotations.WifiStandard int standard) {
|
||||||
try {
|
try {
|
||||||
return mService.isWifiStandardSupported(standard);
|
return mService.isWifiStandardSupported(standard);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package android.net.wifi.nl80211;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.net.wifi.ScanResult;
|
import android.net.wifi.ScanResult;
|
||||||
|
import android.net.wifi.WifiAnnotations.ChannelWidth;
|
||||||
|
import android.net.wifi.WifiAnnotations.WifiStandard;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -28,6 +30,9 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* DeviceWiphyCapabilities for wificond
|
* DeviceWiphyCapabilities for wificond
|
||||||
*
|
*
|
||||||
|
* Contains the WiFi physical layer attributes and capabilities of the device.
|
||||||
|
* It is used to collect these attributes from the device driver via wificond.
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
@@ -61,7 +66,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
|
|||||||
* valid values from {@link ScanResult}'s {@code WIFI_STANDARD_}
|
* valid values from {@link ScanResult}'s {@code WIFI_STANDARD_}
|
||||||
* @return {@code true} if supported, {@code false} otherwise.
|
* @return {@code true} if supported, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isWifiStandardSupported(int standard) {
|
public boolean isWifiStandardSupported(@WifiStandard int standard) {
|
||||||
switch (standard) {
|
switch (standard) {
|
||||||
case ScanResult.WIFI_STANDARD_LEGACY:
|
case ScanResult.WIFI_STANDARD_LEGACY:
|
||||||
return true;
|
return true;
|
||||||
@@ -84,7 +89,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
|
|||||||
* valid values from {@link ScanResult}'s {@code WIFI_STANDARD_}
|
* valid values from {@link ScanResult}'s {@code WIFI_STANDARD_}
|
||||||
* @param support {@code true} if supported, {@code false} otherwise.
|
* @param support {@code true} if supported, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public void setWifiStandardSupport(int standard, boolean support) {
|
public void setWifiStandardSupport(@WifiStandard int standard, boolean support) {
|
||||||
switch (standard) {
|
switch (standard) {
|
||||||
case ScanResult.WIFI_STANDARD_11N:
|
case ScanResult.WIFI_STANDARD_11N:
|
||||||
m80211nSupported = support;
|
m80211nSupported = support;
|
||||||
@@ -107,7 +112,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @return {@code true} if supported, {@code false} otherwise.
|
* @return {@code true} if supported, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isChannelWidthSupported(int chWidth) {
|
public boolean isChannelWidthSupported(@ChannelWidth int chWidth) {
|
||||||
switch (chWidth) {
|
switch (chWidth) {
|
||||||
case ScanResult.CHANNEL_WIDTH_20MHZ:
|
case ScanResult.CHANNEL_WIDTH_20MHZ:
|
||||||
return true;
|
return true;
|
||||||
@@ -131,8 +136,10 @@ public final class DeviceWiphyCapabilities implements Parcelable {
|
|||||||
* @param chWidth valid values are {@link ScanResult#CHANNEL_WIDTH_160MHZ} and
|
* @param chWidth valid values are {@link ScanResult#CHANNEL_WIDTH_160MHZ} and
|
||||||
* {@link ScanResult#CHANNEL_WIDTH_80MHZ_PLUS_MHZ}
|
* {@link ScanResult#CHANNEL_WIDTH_80MHZ_PLUS_MHZ}
|
||||||
* @param support {@code true} if supported, {@code false} otherwise.
|
* @param support {@code true} if supported, {@code false} otherwise.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setChannelWidthSupported(int chWidth, boolean support) {
|
public void setChannelWidthSupported(@ChannelWidth int chWidth, boolean support) {
|
||||||
switch (chWidth) {
|
switch (chWidth) {
|
||||||
case ScanResult.CHANNEL_WIDTH_160MHZ:
|
case ScanResult.CHANNEL_WIDTH_160MHZ:
|
||||||
mChannelWidth160MhzSupported = support;
|
mChannelWidth160MhzSupported = support;
|
||||||
@@ -159,6 +166,8 @@ public final class DeviceWiphyCapabilities implements Parcelable {
|
|||||||
* Set maximum number of transmit spatial streams
|
* Set maximum number of transmit spatial streams
|
||||||
*
|
*
|
||||||
* @param streams number of spatial streams
|
* @param streams number of spatial streams
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setMaxNumberTxSpatialStreams(int streams) {
|
public void setMaxNumberTxSpatialStreams(int streams) {
|
||||||
mMaxNumberTxSpatialStreams = streams;
|
mMaxNumberTxSpatialStreams = streams;
|
||||||
@@ -177,6 +186,8 @@ public final class DeviceWiphyCapabilities implements Parcelable {
|
|||||||
* Set maximum number of receive spatial streams
|
* Set maximum number of receive spatial streams
|
||||||
*
|
*
|
||||||
* @param streams number of streams
|
* @param streams number of streams
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setMaxNumberRxSpatialStreams(int streams) {
|
public void setMaxNumberRxSpatialStreams(int streams) {
|
||||||
mMaxNumberRxSpatialStreams = streams;
|
mMaxNumberRxSpatialStreams = streams;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ScanResultTest {
|
|||||||
public static final int TEST_LEVEL = -56;
|
public static final int TEST_LEVEL = -56;
|
||||||
public static final int TEST_FREQUENCY = 2412;
|
public static final int TEST_FREQUENCY = 2412;
|
||||||
public static final long TEST_TSF = 04660l;
|
public static final long TEST_TSF = 04660l;
|
||||||
public static final @ScanResult.WifiStandard int TEST_WIFI_STANDARD =
|
public static final @WifiAnnotations.WifiStandard int TEST_WIFI_STANDARD =
|
||||||
ScanResult.WIFI_STANDARD_11AC;
|
ScanResult.WIFI_STANDARD_11AC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user