Wifi: add maximum channel bandwidth limit to softAp

This commit adds the maximum bandwidth limit on softAp connection.

Bug: 215120219
Test: VTS test
Change-Id: Ic364ad13ec2787080f99479e00bce5aacf88022d
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl
index bdbaadd..ca20f37 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl
@@ -37,7 +37,7 @@
   String ifaceName;
   String apIfaceInstance;
   int freqMhz;
-  android.hardware.wifi.hostapd.Bandwidth bandwidth;
+  android.hardware.wifi.hostapd.ChannelBandwidth channelBandwidth;
   android.hardware.wifi.hostapd.Generation generation;
   byte[] apIfaceInstanceMacAddress;
 }
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Bandwidth.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
similarity index 86%
rename from wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Bandwidth.aidl
rename to wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
index 4d78640..6c1fd22 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Bandwidth.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
@@ -33,17 +33,18 @@
 
 package android.hardware.wifi.hostapd;
 @Backing(type="int") @VintfStability
-enum Bandwidth {
+enum ChannelBandwidth {
   BANDWIDTH_INVALID = 0,
-  BANDWIDTH_20_NOHT = 1,
-  BANDWIDTH_20 = 2,
-  BANDWIDTH_40 = 3,
-  BANDWIDTH_80 = 4,
-  BANDWIDTH_80P80 = 5,
-  BANDWIDTH_160 = 6,
-  BANDWIDTH_320 = 7,
-  BANDWIDTH_2160 = 8,
-  BANDWIDTH_4320 = 9,
-  BANDWIDTH_6480 = 10,
-  BANDWIDTH_8640 = 11,
+  BANDWIDTH_AUTO = 1,
+  BANDWIDTH_20_NOHT = 2,
+  BANDWIDTH_20 = 3,
+  BANDWIDTH_40 = 4,
+  BANDWIDTH_80 = 5,
+  BANDWIDTH_80P80 = 6,
+  BANDWIDTH_160 = 7,
+  BANDWIDTH_320 = 8,
+  BANDWIDTH_2160 = 9,
+  BANDWIDTH_4320 = 10,
+  BANDWIDTH_6480 = 11,
+  BANDWIDTH_8640 = 12,
 }
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl
index 8d8d7bb..d732bcb 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl
@@ -44,4 +44,5 @@
   boolean enableHeTargetWakeTime;
   boolean enableEdmg;
   boolean enable80211BE;
+  android.hardware.wifi.hostapd.ChannelBandwidth maximumChannelBandwidth;
 }
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl
index bf506b2..a6fe63b 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl
@@ -16,7 +16,7 @@
 
 package android.hardware.wifi.hostapd;
 
-import android.hardware.wifi.hostapd.Bandwidth;
+import android.hardware.wifi.hostapd.ChannelBandwidth;
 import android.hardware.wifi.hostapd.Generation;
 
 /**
@@ -44,9 +44,9 @@
     int freqMhz;
 
     /**
-     * The operational bandwidth of the AP.
+     * The operational channel bandwidth of the AP.
      */
-    Bandwidth bandwidth;
+    ChannelBandwidth channelBandwidth;
 
     /**
      * The operational mode of the AP (e.g. 11ac, 11ax).
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl
deleted file mode 100644
index e605153..0000000
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.wifi.hostapd;
-
-/**
- * The channel bandwidth of the AP.
- */
-@VintfStability
-@Backing(type="int")
-enum Bandwidth {
-    BANDWIDTH_INVALID = 0,
-    BANDWIDTH_20_NOHT = 1,
-    BANDWIDTH_20 = 2,
-    BANDWIDTH_40 = 3,
-    BANDWIDTH_80 = 4,
-    BANDWIDTH_80P80 = 5,
-    BANDWIDTH_160 = 6,
-    BANDWIDTH_320 = 7,
-    BANDWIDTH_2160 = 8,
-    BANDWIDTH_4320 = 9,
-    BANDWIDTH_6480 = 10,
-    BANDWIDTH_8640 = 11,
-}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ChannelBandwidth.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
new file mode 100644
index 0000000..8ea3952
--- /dev/null
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.hostapd;
+
+/**
+ * The channel bandwidth of the AP.
+ */
+@VintfStability
+@Backing(type="int")
+enum ChannelBandwidth {
+    /**
+     * Invalid bandwidth value for AP
+     */
+    BANDWIDTH_INVALID = 0,
+    /**
+     * Channel bandwidth is auto-selected by the chip
+     */
+    BANDWIDTH_AUTO = 1,
+    /**
+     * AP channel bandwidth is 20 MHz but not HT
+     */
+    BANDWIDTH_20_NOHT = 2,
+    /**
+     * AP channel bandwidth is 20 MHz
+     */
+    BANDWIDTH_20 = 3,
+    /**
+     * AP channel bandwidth is 40 MHz
+     */
+    BANDWIDTH_40 = 4,
+    /**
+     * AP channel bandwidth is 80 MHz
+     */
+    BANDWIDTH_80 = 5,
+    /**
+     * AP channel bandwidth is 80+80 MHz
+     */
+    BANDWIDTH_80P80 = 6,
+    /**
+     * AP channel bandwidth is 160 MHz
+     */
+    BANDWIDTH_160 = 7,
+    /**
+     * AP channel bandwidth is 320 MHz
+     */
+    BANDWIDTH_320 = 8,
+    /**
+     * AP channel bandwidth is 2160 MHz
+     */
+    BANDWIDTH_2160 = 9,
+    /**
+     * AP channel bandwidth is 4320 MHz
+     */
+    BANDWIDTH_4320 = 10,
+    /**
+     * AP channel bandwidth is 6480 MHz
+     */
+    BANDWIDTH_6480 = 11,
+    /**
+     * AP channel bandwidth is 8640 MHz
+     */
+    BANDWIDTH_8640 = 12,
+}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl
index e66a24a..320db9c 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl
@@ -16,6 +16,8 @@
 
 package android.hardware.wifi.hostapd;
 
+import android.hardware.wifi.hostapd.ChannelBandwidth;
+
 /**
  * Parameters to control the HW mode for the interface.
  */
@@ -74,4 +76,9 @@
      * used with Extreme High Throughput.
      */
     boolean enable80211BE;
+    /**
+     * Limit on maximum channel bandwidth for the softAp.
+     * For automatic selection with no limit use BANDWIDTH_AUTO
+     */
+    ChannelBandwidth maximumChannelBandwidth;
 }