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

Commit 6b5104cf authored by Sunil Ravi's avatar Sunil Ravi
Browse files

Get the device support for cross-akm roaming

Read NL80211_ATTR_MAX_NUM_AKM_SUITES attribute from
wiphy info to get the device support for cross-akm
roaming feature.

Bug: 313038031
Test: Manual - STA connection
Test: atest DeviceWiphyCapabilitiesTest
Test: atest WifiNl80211ManagerTest
Change-Id: Ib429a4826ed3110d128c7a6929c73b73d89f06a3
parent 8a091a74
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9657,6 +9657,7 @@ package android.net.wifi.nl80211 {
  public final class DeviceWiphyCapabilities implements android.os.Parcelable {
    ctor public DeviceWiphyCapabilities();
    method public int describeContents();
    method @FlaggedApi("android.net.wifi.flags.get_device_cross_akm_roaming_support") public int getMaxNumberAkms();
    method public int getMaxNumberRxSpatialStreams();
    method public int getMaxNumberTxSpatialStreams();
    method public boolean isChannelWidthSupported(int);
+29 −2
Original line number Diff line number Diff line
@@ -16,11 +16,13 @@

package android.net.wifi.nl80211;

import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiAnnotations.ChannelWidth;
import android.net.wifi.WifiAnnotations.WifiStandard;
import android.net.wifi.flags.Flags;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
@@ -48,6 +50,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
    private boolean mChannelWidth320MhzSupported;
    private int mMaxNumberTxSpatialStreams;
    private int mMaxNumberRxSpatialStreams;
    private int mMaxNumberAkms;


    /** public constructor */
@@ -61,6 +64,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
        mChannelWidth320MhzSupported = false;
        mMaxNumberTxSpatialStreams = 1;
        mMaxNumberRxSpatialStreams = 1;
        mMaxNumberAkms = 1;
    }

    /**
@@ -198,6 +202,25 @@ public final class DeviceWiphyCapabilities implements Parcelable {
        return mMaxNumberRxSpatialStreams;
    }

    /**
     * Get the maximum number of AKM suites supported in the connection request to the driver.
     *
     * @return maximum number of AKMs
     */
    @FlaggedApi(Flags.FLAG_GET_DEVICE_CROSS_AKM_ROAMING_SUPPORT)
    public int getMaxNumberAkms() {
        return mMaxNumberAkms;
    }

    /**
     * Set the maximum number of AKM suites supported in the connection request to the driver.
     *
     * @hide
     */
    public void setMaxNumberAkms(int akms) {
        mMaxNumberAkms = akms;
    }

    /**
     * Set maximum number of receive spatial streams
     *
@@ -226,7 +249,8 @@ public final class DeviceWiphyCapabilities implements Parcelable {
                && mChannelWidth80p80MhzSupported == capa.mChannelWidth80p80MhzSupported
                && mChannelWidth320MhzSupported == capa.mChannelWidth320MhzSupported
                && mMaxNumberTxSpatialStreams == capa.mMaxNumberTxSpatialStreams
                && mMaxNumberRxSpatialStreams == capa.mMaxNumberRxSpatialStreams;
                && mMaxNumberRxSpatialStreams == capa.mMaxNumberRxSpatialStreams
                && mMaxNumberAkms == capa.mMaxNumberAkms;
    }

    /** override hash code */
@@ -235,7 +259,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
        return Objects.hash(m80211nSupported, m80211acSupported, m80211axSupported,
                m80211beSupported, mChannelWidth160MhzSupported, mChannelWidth80p80MhzSupported,
                mChannelWidth320MhzSupported, mMaxNumberTxSpatialStreams,
                mMaxNumberRxSpatialStreams);
                mMaxNumberRxSpatialStreams, mMaxNumberAkms);
    }

    /** implement Parcelable interface */
@@ -259,6 +283,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
        out.writeBoolean(mChannelWidth320MhzSupported);
        out.writeInt(mMaxNumberTxSpatialStreams);
        out.writeInt(mMaxNumberRxSpatialStreams);
        out.writeInt(mMaxNumberAkms);
    }

    @Override
@@ -276,6 +301,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
                .append(mChannelWidth320MhzSupported ? "Yes" : "No");
        sb.append("mMaxNumberTxSpatialStreams: ").append(mMaxNumberTxSpatialStreams);
        sb.append("mMaxNumberRxSpatialStreams: ").append(mMaxNumberRxSpatialStreams);
        sb.append("mMaxNumberAkms: ").append(mMaxNumberAkms);

        return sb.toString();
    }
@@ -298,6 +324,7 @@ public final class DeviceWiphyCapabilities implements Parcelable {
            capabilities.mChannelWidth320MhzSupported = in.readBoolean();
            capabilities.mMaxNumberTxSpatialStreams = in.readInt();
            capabilities.mMaxNumberRxSpatialStreams = in.readInt();
            capabilities.mMaxNumberAkms = in.readInt();
            return capabilities;
        }

+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class DeviceWiphyCapabilitiesTest {
        capa.setChannelWidthSupported(ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ, false);
        capa.setMaxNumberTxSpatialStreams(2);
        capa.setMaxNumberRxSpatialStreams(1);
        capa.setMaxNumberAkms(2);

        Parcel parcel = Parcel.obtain();
        capa.writeToParcel(parcel, 0);
+1 −0
Original line number Diff line number Diff line
@@ -1130,6 +1130,7 @@ public class WifiNl80211ManagerTest {
        capaExpected.setChannelWidthSupported(ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ, false);
        capaExpected.setMaxNumberTxSpatialStreams(2);
        capaExpected.setMaxNumberRxSpatialStreams(1);
        capaExpected.setMaxNumberAkms(2);

        when(mWificond.getDeviceWiphyCapabilities(TEST_INTERFACE_NAME))
                .thenReturn(capaExpected);