Wifi: Add frequency list to chanelPrams in hostapd

This commit adds a new parameter to the channel parameters for IHostapd
Hidl interface to handle a list of channel freq in MHz to be used in
ACS. This is needed as part of support of Wifi 6GHz band since 6GHz band
channels use same channel numbers as 2.4/5GHz bands.

Bug: 146186687
Bug: 139354972
Test: Manual
Test: VTS test
Change-Id: I8692f3cd28cfaae1d3b870c9f8dbcdd2ff350ee4
diff --git a/wifi/hostapd/1.2/IHostapd.hal b/wifi/hostapd/1.2/IHostapd.hal
index b25ea97..5e6d80a 100644
--- a/wifi/hostapd/1.2/IHostapd.hal
+++ b/wifi/hostapd/1.2/IHostapd.hal
@@ -57,6 +57,7 @@
          * used with HE.
          */
         bool enable80211AX;
+
         /**
          * Whether 6GHz band enabled or not on softAp.
          * Note: hw_mode=a is used to specify that 5 GHz band or 6 GHz band is
@@ -96,6 +97,21 @@
     };
 
     /**
+     * Parameters to specify the channel frequency range for ACS.
+     */
+    struct AcsFrequencyRange {
+        /**
+         * Channel Frequency (in MHz) at the start of the range.
+         */
+        uint32_t start;
+
+        /**
+         * Channel Frequency (in MHz) at the end of the range.
+         */
+        uint32_t end;
+    };
+
+    /**
      * Parameters to control the channel selection for the interface.
      */
     struct ChannelParams {
@@ -103,6 +119,15 @@
          * Band to use for the SoftAp operations.
          */
         bitfield<BandMask> bandMask;
+
+        /**
+         * This option can be used to specify the channel frequencies (in MHz) selected by ACS.
+         * If this is an empty list, all channels allowed in selected HW mode
+         * are specified implicitly.
+         * Note: channels may be overridden by firmware.
+         * Note: this option is ignored if ACS is disabled.
+         */
+        vec<AcsFrequencyRange> acsChannelFreqRangesMhz;
     };
 
     /**
@@ -113,9 +138,15 @@
          * Baseline information as defined in HAL 1.1.
          */
         @1.1::IHostapd.IfaceParams V1_1;
-        /** Additional Hw mode params for the interface */
+
+        /**
+         * Additional Hw mode params for the interface
+         */
         HwModeParams hwModeParams;
-        /** Additional Channel params for the interface */
+
+        /**
+         * Additional Channel params for the interface
+         */
         ChannelParams channelParams;
     };
 
@@ -135,7 +166,7 @@
      *         |HostapdStatusCode.FAILURE_IFACE_EXISTS|
      */
     addAccessPoint_1_2(IfaceParams ifaceParams, NetworkParams nwParams)
-        generates(HostapdStatus status);
+        generates (HostapdStatus status);
 
     /**
      * force one of the hotspot clients disconnect..
diff --git a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp
index 8245f8f..94cbb42 100644
--- a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp
@@ -109,28 +109,26 @@
         return iface_params_1_2;
     }
 
-    IHostapd::IfaceParams getIfaceParamsWithAcsAndChannelRange() {
+    IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange() {
         IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs();
-        ::android::hardware::wifi::hostapd::V1_1::IHostapd::ChannelParams
-            channelParams;
-        ::android::hardware::wifi::hostapd::V1_1::IHostapd::AcsChannelRange
-            acsChannelRange;
-        acsChannelRange.start = 1;
-        acsChannelRange.end = 11;
-        std::vector<
-            ::android::hardware::wifi::hostapd::V1_1::IHostapd::AcsChannelRange>
-            vec_acsChannelRange;
-        vec_acsChannelRange.push_back(acsChannelRange);
-        channelParams.acsChannelRanges = vec_acsChannelRange;
-        iface_params_1_2.V1_1.channelParams = channelParams;
+        ::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange
+            acsFrequencyRange;
+        acsFrequencyRange.start = 2412;
+        acsFrequencyRange.end = 2462;
+        std::vector<::android::hardware::wifi::hostapd::V1_2::IHostapd::
+                        AcsFrequencyRange>
+            vec_acsFrequencyRange;
+        vec_acsFrequencyRange.push_back(acsFrequencyRange);
+        iface_params_1_2.channelParams.acsChannelFreqRangesMhz =
+            vec_acsFrequencyRange;
         return iface_params_1_2;
     }
 
-    IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidChannelRange() {
+    IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange() {
         IHostapd::IfaceParams iface_params_1_2 =
-            getIfaceParamsWithAcsAndChannelRange();
-        iface_params_1_2.V1_1.channelParams.acsChannelRanges[0].start = 222;
-        iface_params_1_2.V1_1.channelParams.acsChannelRanges[0].end = 999;
+            getIfaceParamsWithAcsAndFreqRange();
+        iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].start = 222;
+        iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].end = 999;
         return iface_params_1_2;
     }
 
@@ -186,13 +184,13 @@
 }
 
 /**
- * Adds an access point with PSK network config, ACS enabled & channel Range.
+ * Adds an access point with PSK network config, ACS enabled & frequency Range.
  * Access point creation should pass.
  */
-TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndChannelRange) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
     auto status =
         HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
-                    getIfaceParamsWithAcsAndChannelRange(), getPskNwParams());
+                    getIfaceParamsWithAcsAndFreqRange(), getPskNwParams());
     // TODO: b/140172237, fix this in R
     // EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
 }
@@ -201,9 +199,9 @@
  * Adds an access point with invalid channel range.
  * Access point creation should fail.
  */
-TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidChannelRange) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
     auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
-                              getIfaceParamsWithAcsAndInvalidChannelRange(),
+                              getIfaceParamsWithAcsAndInvalidFreqRange(),
                               getPskNwParams());
     // TODO: b/140172237, fix this in R
     // EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
@@ -245,14 +243,15 @@
  * Access point creation & removal should pass.
  */
 TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
-                              getIfaceParamsWithAcs(), getPskNwParams());
+    auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
+                                  getIfaceParamsWithAcs(), getPskNwParams());
     // TODO: b/140172237, fix this in R
     /*
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
-    status =
+    EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
+    auto status =
         HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    EXPECT_EQ(android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
+    status.code);
     */
 }