diff --git a/Android.bp b/Android.bp index 33faf633e6c9e..d63cd4ef06143 100644 --- a/Android.bp +++ b/Android.bp @@ -700,6 +700,7 @@ filegroup { "core/java/android/annotation/CurrentTimeMillisLong.java", "core/java/android/annotation/IntDef.java", "core/java/android/annotation/IntRange.java", + "core/java/android/annotation/LongDef.java", "core/java/android/annotation/NonNull.java", "core/java/android/annotation/Nullable.java", "core/java/android/annotation/RequiresPermission.java", diff --git a/api/system-current.txt b/api/system-current.txt index 2d5655ac85adf..2c6228c31932b 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7200,12 +7200,12 @@ package android.net.wifi { public final class SoftApCapability implements android.os.Parcelable { method public int describeContents(); method public int getMaxSupportedClients(); - method public boolean isFeatureSupported(int); + method public boolean isFeatureSupported(long); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; - field public static final int SOFTAP_FEATURE_ACS_OFFLOAD = 1; // 0x1 - field public static final int SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 2; // 0x2 - field public static final int SOFTAP_FEATURE_WPA3_SAE = 4; // 0x4 + field public static final long SOFTAP_FEATURE_ACS_OFFLOAD = 1L; // 0x1L + field public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 2L; // 0x2L + field public static final long SOFTAP_FEATURE_WPA3_SAE = 4L; // 0x4L } public final class SoftApConfiguration implements android.os.Parcelable { diff --git a/wifi/java/android/net/wifi/SoftApCapability.java b/wifi/java/android/net/wifi/SoftApCapability.java index 2bbe7d2aa4ec5..a831984f3968a 100644 --- a/wifi/java/android/net/wifi/SoftApCapability.java +++ b/wifi/java/android/net/wifi/SoftApCapability.java @@ -16,7 +16,7 @@ package android.net.wifi; -import android.annotation.IntDef; +import android.annotation.LongDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; @@ -47,7 +47,7 @@ public final class SoftApCapability implements Parcelable { * {@link SoftApInfo#getFrequency} and {@link SoftApInfo#getBandwidth} to get * driver channel selection result. */ - public static final int SOFTAP_FEATURE_ACS_OFFLOAD = 1 << 0; + public static final long SOFTAP_FEATURE_ACS_OFFLOAD = 1 << 0; /** * Support for client force disconnect. @@ -59,7 +59,7 @@ public final class SoftApCapability implements Parcelable { * Check feature support before invoking * {@link SoftApConfiguration.Builder#setMaxNumberOfClients(int)} */ - public static final int SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 1 << 1; + public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 1 << 1; /** @@ -67,18 +67,18 @@ public final class SoftApCapability implements Parcelable { * * flag when {@link config_wifi_softap_sae_supported)} is true. */ - public static final int SOFTAP_FEATURE_WPA3_SAE = 1 << 2; + public static final long SOFTAP_FEATURE_WPA3_SAE = 1 << 2; /** @hide */ @Retention(RetentionPolicy.SOURCE) - @IntDef(flag = true, prefix = { "SOFTAP_FEATURE_" }, value = { + @LongDef(flag = true, prefix = { "SOFTAP_FEATURE_" }, value = { SOFTAP_FEATURE_ACS_OFFLOAD, SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT, SOFTAP_FEATURE_WPA3_SAE, }) public @interface HotspotFeatures {} - private @HotspotFeatures int mSupportedFeatures = 0; + private @HotspotFeatures long mSupportedFeatures = 0; private int mMaximumSupportedClientNumber; @@ -104,7 +104,7 @@ public final class SoftApCapability implements Parcelable { * * @param feature one of feature from {@link HotspotFeatures} */ - public boolean isFeatureSupported(@HotspotFeatures int feature) { + public boolean isFeatureSupported(@HotspotFeatures long feature) { return (mSupportedFeatures & feature) == feature; } @@ -125,7 +125,7 @@ public final class SoftApCapability implements Parcelable { * @param features One or combination of the feature from {@link @HotspotFeatures}. * @hide */ - public SoftApCapability(@HotspotFeatures int features) { + public SoftApCapability(@HotspotFeatures long features) { mSupportedFeatures = features; } @@ -138,7 +138,7 @@ public final class SoftApCapability implements Parcelable { @Override /** Implement the Parcelable interface */ public void writeToParcel(@NonNull Parcel dest, int flags) { - dest.writeInt(mSupportedFeatures); + dest.writeLong(mSupportedFeatures); dest.writeInt(mMaximumSupportedClientNumber); } @@ -146,7 +146,7 @@ public final class SoftApCapability implements Parcelable { /** Implement the Parcelable interface */ public static final Creator CREATOR = new Creator() { public SoftApCapability createFromParcel(Parcel in) { - int supportedFeatures = in.readInt(); + long supportedFeatures = in.readLong(); SoftApCapability capability = new SoftApCapability(supportedFeatures); capability.mMaximumSupportedClientNumber = in.readInt(); return capability; diff --git a/wifi/tests/src/android/net/wifi/SoftApCapabilityTest.java b/wifi/tests/src/android/net/wifi/SoftApCapabilityTest.java index ef476ebc26678..73b501a4d8f23 100644 --- a/wifi/tests/src/android/net/wifi/SoftApCapabilityTest.java +++ b/wifi/tests/src/android/net/wifi/SoftApCapabilityTest.java @@ -35,7 +35,7 @@ public class SoftApCapabilityTest { */ @Test public void testCopyOperator() throws Exception { - int testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT + long testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT | SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD; SoftApCapability capability = new SoftApCapability(testSoftApFeature); capability.setMaxSupportedClients(10); @@ -51,7 +51,7 @@ public class SoftApCapabilityTest { */ @Test public void testParcelOperation() throws Exception { - int testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT + long testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT | SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD; SoftApCapability capability = new SoftApCapability(testSoftApFeature); capability.setMaxSupportedClients(10);