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

Commit 427a30c8 authored by Les Lee's avatar Les Lee Committed by Android (Google) Code Review
Browse files

Merge "wifi: Use long to replace int for softap feature set"

parents 37c514c0 d41a2995
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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",
+4 −4
Original line number Diff line number Diff line
@@ -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<android.net.wifi.SoftApCapability> 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 {
+10 −10
Original line number Diff line number Diff line
@@ -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<SoftApCapability> CREATOR = new Creator<SoftApCapability>() {
        public SoftApCapability createFromParcel(Parcel in) {
            int supportedFeatures = in.readInt();
            long supportedFeatures = in.readLong();
            SoftApCapability capability = new SoftApCapability(supportedFeatures);
            capability.mMaximumSupportedClientNumber = in.readInt();
            return capability;
+2 −2
Original line number Diff line number Diff line
@@ -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);