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

Commit 8a8eb6e5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "wifi: Create 1.3::IfaceParams to support dual bands (AP+AP Part 1)"

parents 514435af 65caf767
Loading
Loading
Loading
Loading
+48 −1
Original line number Diff line number Diff line
@@ -26,6 +26,53 @@ import IHostapdCallback;
 * Top-level object for managing SoftAPs.
 */
interface IHostapd extends @1.2::IHostapd {

    /**
     * Parameters to control the channel selection for the interface.
     */
    struct ChannelParams {
        /**
         * Baseline information as defined in HAL 1.2.
         *
         * Includes bandMask and acsChannelFreqRangesMhz
         */
        @1.2::IHostapd.ChannelParams V1_2;

        /**
         * Whether to enable ACS (Automatic Channel Selection) or not.
         * The channel can be selected automatically at run time by setting
         * this flag, which must enable the ACS survey based algorithm.
         *
         * Note: It is used instead of V1_0::ChannelParams.enableAcs inside
         * V1_3::IfaceParams.V1_2.V1_1.V1_0.
         */
        bool enableAcs;

        /**
         * Channel number (IEEE 802.11) to use for the interface.
         * If ACS is enabled, this field is ignored.
         *
         * Note: It is used instead of V1_0::ChannelParams.channel inside
         * V1_3::IfaceParams.V1_2.V1_1.V1_0.
         */
        uint32_t channel;
    };

    /**
     * Parameters to use for setting up the dual access point interfaces.
     */
    struct IfaceParams {
        /**
         * Baseline information as defined in HAL 1.2.
         */
        @1.2::IHostapd.IfaceParams V1_2;

        /**
         * The list of the channel params for the dual interfaces.
         */
        vec<ChannelParams> channelParamsList;
    };

    /**
     * Parameters to use for setting up the access point network.
     */
@@ -57,7 +104,7 @@ interface IHostapd extends @1.2::IHostapd {
     *         |HostapdStatusCode.FAILURE_UNKNOWN|,
     *         |HostapdStatusCode.FAILURE_IFACE_EXISTS|
     */
    addAccessPoint_1_3(@1.2::IHostapd.IfaceParams ifaceParams, NetworkParams nwParams)
    addAccessPoint_1_3(IfaceParams ifaceParams, NetworkParams nwParams)
        generates (HostapdStatus status);

    /**
+58 −19
Original line number Diff line number Diff line
@@ -95,7 +95,16 @@ class HostapdHidlTest
            iface_params;
        ::android::hardware::wifi::hostapd::V1_1::IHostapd::IfaceParams
            iface_params_1_1;
        IHostapd::IfaceParams iface_params_1_2;
        ::android::hardware::wifi::hostapd::V1_2::IHostapd::IfaceParams
            iface_params_1_2;
        IHostapd::IfaceParams iface_params_1_3;

        std::vector<
            ::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams>
            vec_channelParams;

        ::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams
            channelParams_1_3;

        iface_params.ifaceName = getPrimaryWlanIfaceName();
        iface_params.hwModeParams.enable80211N = true;
@@ -111,23 +120,39 @@ class HostapdHidlTest
        iface_params_1_2.channelParams.bandMask = 0;
        iface_params_1_2.channelParams.bandMask |=
            IHostapd::BandMask::BAND_2_GHZ;
        return iface_params_1_2;

        // Newly added attributes in V1_3
        channelParams_1_3.channel = iface_params.channelParams.channel;
        channelParams_1_3.enableAcs = iface_params.channelParams.enableAcs;
        channelParams_1_3.V1_2 = iface_params_1_2.channelParams;

        vec_channelParams.push_back(channelParams_1_3);
        iface_params_1_3.V1_2 = iface_params_1_2;
        iface_params_1_3.channelParamsList = vec_channelParams;
        return iface_params_1_3;
    }

    IHostapd::IfaceParams getIfaceParamsWithAcs() {
        // First get the settings for WithoutAcs and then make changes
        IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs();
        iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = true;
        iface_params_1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs = true;
        iface_params_1_2.V1_1.V1_0.channelParams.channel = 0;
        iface_params_1_2.channelParams.bandMask |=
        IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithoutAcs();
        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.enableAcs = true;
        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs =
            true;
        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel = 0;
        iface_params_1_3.V1_2.channelParams.bandMask |=
            IHostapd::BandMask::BAND_5_GHZ;
        iface_params_1_3.channelParamsList[0].channel =
            iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel;
        iface_params_1_3.channelParamsList[0].enableAcs =
            iface_params_1_3.V1_2.V1_1.V1_0.channelParams.enableAcs;
        iface_params_1_3.channelParamsList[0].V1_2 =
            iface_params_1_3.V1_2.channelParams;

        return iface_params_1_2;
        return iface_params_1_3;
    }

    IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange() {
        IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs();
        IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithAcs();
        ::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange
            acsFrequencyRange;
        acsFrequencyRange.start = 2412;
@@ -136,17 +161,23 @@ class HostapdHidlTest
                        AcsFrequencyRange>
            vec_acsFrequencyRange;
        vec_acsFrequencyRange.push_back(acsFrequencyRange);
        iface_params_1_2.channelParams.acsChannelFreqRangesMhz =
        iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz =
            vec_acsFrequencyRange;
        return iface_params_1_2;
        iface_params_1_3.channelParamsList[0].V1_2 =
            iface_params_1_3.V1_2.channelParams;
        return iface_params_1_3;
    }

    IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange() {
        IHostapd::IfaceParams iface_params_1_2 =
        IHostapd::IfaceParams iface_params_1_3 =
            getIfaceParamsWithAcsAndFreqRange();
        iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].start = 222;
        iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].end = 999;
        return iface_params_1_2;
        iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz[0].start =
            222;
        iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz[0].end =
            999;
        iface_params_1_3.channelParamsList[0].V1_2 =
            iface_params_1_3.V1_2.channelParams;
        return iface_params_1_3;
    }

    IHostapd::NetworkParams getOpenNwParams() {
@@ -218,9 +249,12 @@ class HostapdHidlTest
    }

    IHostapd::IfaceParams getIfaceParamsWithInvalidChannel() {
        IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs();
        iface_params_1_2.V1_1.V1_0.channelParams.channel = kIfaceInvalidChannel;
        return iface_params_1_2;
        IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithoutAcs();
        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel =
            kIfaceInvalidChannel;
        iface_params_1_3.channelParamsList[0].channel =
            iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel;
        return iface_params_1_3;
    }

    // IHostapd object used for all tests in this fixture.
@@ -422,6 +456,11 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
    EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code);
}

/**
 * AddAccessPointWithDualBandConfig should pass
 */
// TODO: Add it after VendorHal ready & add feature support check.

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HostapdHidlTest);
INSTANTIATE_TEST_CASE_P(
    PerInstance, HostapdHidlTest,