Merge changes from topic "remove-radio-combo-matrix" into udc-dev

* changes:
  Update usages of WifiRadioCombinationMatrix in the Vendor HAL service.
  Remove the WifiRadioCombinationsMatrix type from the Vendor HAL interface.
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
index b27b06f..2ff6896 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
@@ -58,7 +58,7 @@
   String[] getP2pIfaceNames();
   @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface getStaIface(in String ifname);
   String[] getStaIfaceNames();
-  android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix();
+  android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations();
   android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities();
   android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask);
   void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo);
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl
deleted file mode 100644
index ea86c4f..0000000
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2022 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.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.wifi;
-@VintfStability
-parcelable WifiRadioCombinationMatrix {
-  android.hardware.wifi.WifiRadioCombination[] radioCombinations;
-}
diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
index de2449e..c0e41cd 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
@@ -31,7 +31,7 @@
 import android.hardware.wifi.WifiDebugRingBufferStatus;
 import android.hardware.wifi.WifiDebugRingBufferVerboseLevel;
 import android.hardware.wifi.WifiIfaceMode;
-import android.hardware.wifi.WifiRadioCombinationMatrix;
+import android.hardware.wifi.WifiRadioCombination;
 import android.hardware.wifi.WifiUsableChannel;
 
 /**
@@ -737,8 +737,7 @@
      * Retrieve the list of all the possible radio combinations supported by this
      * chip.
      *
-     * @return A list of all the possible radio combinations represented by
-     *         |WifiRadioCombinationMatrix|.
+     * @return A list of all the possible radio combinations.
      *         For example, in case of a chip which has two radios, where one radio is
      *         capable of 2.4GHz 2X2 only and another radio which is capable of either
      *         5GHz or 6GHz 2X2, the number of possible radio combinations in this case
@@ -759,7 +758,7 @@
      *         |WifiStatusCode.FAILURE_UNKNOWN|
      *
      */
-    WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix();
+    WifiRadioCombination[] getSupportedRadioCombinations();
 
     /**
      * Get capabilities supported by this chip.
diff --git a/wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl b/wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl
deleted file mode 100644
index b79a818..0000000
--- a/wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2022 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;
-
-import android.hardware.wifi.WifiRadioCombination;
-
-/**
- * Wifi radio combinations matrix retrieved via
- * |IWifiChip.getSupportedRadioCombinationsMatrix|.
- */
-@VintfStability
-parcelable WifiRadioCombinationMatrix {
-    /**
-     * List of all the possible radio combinations that the chip can operate.
-     */
-    WifiRadioCombination[] radioCombinations;
-}
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index d3cf7bf..5bfdcbb 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -2996,14 +2996,13 @@
 
 bool convertLegacyRadioCombinationsMatrixToAidl(
         legacy_hal::wifi_radio_combination_matrix* legacy_matrix,
-        WifiRadioCombinationMatrix* aidl_matrix) {
-    if (!aidl_matrix || !legacy_matrix) {
+        std::vector<WifiRadioCombination>* aidl_combinations) {
+    if (!aidl_combinations || !legacy_matrix) {
         return false;
     }
-    *aidl_matrix = {};
+    *aidl_combinations = {};
 
     int num_combinations = legacy_matrix->num_radio_combinations;
-    std::vector<WifiRadioCombination> radio_combinations_vec;
     if (!num_combinations) {
         LOG(ERROR) << "zero radio combinations";
         return false;
@@ -3029,13 +3028,12 @@
             radio_configurations_vec.push_back(radioConfiguration);
         }
         radioCombination.radioConfigurations = radio_configurations_vec;
-        radio_combinations_vec.push_back(radioCombination);
+        aidl_combinations->push_back(radioCombination);
         l_radio_combinations_ptr =
                 (wifi_radio_combination*)((u8*)l_radio_combinations_ptr +
                                           sizeof(wifi_radio_combination) +
                                           (sizeof(wifi_radio_configuration) * num_configurations));
     }
-    aidl_matrix->radioCombinations = radio_combinations_vec;
     return true;
 }
 
diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h
index 208b734..3da94dc 100644
--- a/wifi/aidl/default/aidl_struct_util.h
+++ b/wifi/aidl/default/aidl_struct_util.h
@@ -64,7 +64,7 @@
         std::vector<legacy_hal::wifi_coex_unsafe_channel>* legacy_unsafe_channels);
 bool convertLegacyRadioCombinationsMatrixToAidl(
         legacy_hal::wifi_radio_combination_matrix* legacy_matrix,
-        WifiRadioCombinationMatrix* aidl_matrix);
+        std::vector<WifiRadioCombination>* aidl_combinations);
 WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band);
 WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg);
 bool convertLegacyIfaceCombinationsMatrixToChipMode(
diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp
index 9997937..4bd77ac 100644
--- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp
+++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp
@@ -753,21 +753,22 @@
             sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]),
             radio_configurations_array3);
 
-    WifiRadioCombinationMatrix converted_matrix{};
-    aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, &converted_matrix);
+    std::vector<WifiRadioCombination> converted_combinations;
+    aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix,
+                                                                 &converted_combinations);
 
     // Verify the conversion
-    EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size());
+    EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_combinations.size());
     verifyRadioCombination(
-            &converted_matrix.radioCombinations[0],
+            &converted_combinations[0],
             sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]),
             radio_configurations_array1);
     verifyRadioCombination(
-            &converted_matrix.radioCombinations[1],
+            &converted_combinations[1],
             sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]),
             radio_configurations_array2);
     verifyRadioCombination(
-            &converted_matrix.radioCombinations[2],
+            &converted_combinations[2],
             sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]),
             radio_configurations_array3);
 }
diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp
index bb3eaf0..89edaa4 100644
--- a/wifi/aidl/default/wifi_chip.cpp
+++ b/wifi/aidl/default/wifi_chip.cpp
@@ -711,10 +711,10 @@
                            &WifiChip::triggerSubsystemRestartInternal);
 }
 
-ndk::ScopedAStatus WifiChip::getSupportedRadioCombinationsMatrix(
-        WifiRadioCombinationMatrix* _aidl_return) {
+ndk::ScopedAStatus WifiChip::getSupportedRadioCombinations(
+        std::vector<WifiRadioCombination>* _aidl_return) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
-                           &WifiChip::getSupportedRadioCombinationsMatrixInternal, _aidl_return);
+                           &WifiChip::getSupportedRadioCombinationsInternal, _aidl_return);
 }
 
 ndk::ScopedAStatus WifiChip::getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) {
@@ -1440,26 +1440,26 @@
     return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
 }
 
-std::pair<WifiRadioCombinationMatrix, ndk::ScopedAStatus>
-WifiChip::getSupportedRadioCombinationsMatrixInternal() {
+std::pair<std::vector<WifiRadioCombination>, ndk::ScopedAStatus>
+WifiChip::getSupportedRadioCombinationsInternal() {
     legacy_hal::wifi_error legacy_status;
     legacy_hal::wifi_radio_combination_matrix* legacy_matrix;
+    std::vector<WifiRadioCombination> aidl_combinations;
 
     std::tie(legacy_status, legacy_matrix) =
             legacy_hal_.lock()->getSupportedRadioCombinationsMatrix();
     if (legacy_status != legacy_hal::WIFI_SUCCESS) {
         LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: "
                    << legacyErrorToString(legacy_status);
-        return {WifiRadioCombinationMatrix{}, createWifiStatusFromLegacyError(legacy_status)};
+        return {aidl_combinations, createWifiStatusFromLegacyError(legacy_status)};
     }
 
-    WifiRadioCombinationMatrix aidl_matrix;
     if (!aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix,
-                                                                      &aidl_matrix)) {
+                                                                      &aidl_combinations)) {
         LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToAidl() ";
-        return {WifiRadioCombinationMatrix(), createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)};
+        return {aidl_combinations, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)};
     }
-    return {aidl_matrix, ndk::ScopedAStatus::ok()};
+    return {aidl_combinations, ndk::ScopedAStatus::ok()};
 }
 
 std::pair<WifiChipCapabilities, ndk::ScopedAStatus> WifiChip::getWifiChipCapabilitiesInternal() {
diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h
index def5da0..eca68ed 100644
--- a/wifi/aidl/default/wifi_chip.h
+++ b/wifi/aidl/default/wifi_chip.h
@@ -144,8 +144,8 @@
     ndk::ScopedAStatus setAfcChannelAllowance(
             const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo) override;
     ndk::ScopedAStatus triggerSubsystemRestart() override;
-    ndk::ScopedAStatus getSupportedRadioCombinationsMatrix(
-            WifiRadioCombinationMatrix* _aidl_return) override;
+    ndk::ScopedAStatus getSupportedRadioCombinations(
+            std::vector<WifiRadioCombination>* _aidl_return) override;
     ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override;
     ndk::ScopedAStatus enableStaChannelForPeerNetwork(
             ChannelCategoryMask in_channelCategoryEnableFlag) override;
@@ -258,8 +258,8 @@
     void invalidateAndClearBridgedAp(const std::string& br_name);
     bool findUsingNameFromBridgedApInstances(const std::string& name);
     ndk::ScopedAStatus triggerSubsystemRestartInternal();
-    std::pair<WifiRadioCombinationMatrix, ndk::ScopedAStatus>
-    getSupportedRadioCombinationsMatrixInternal();
+    std::pair<std::vector<WifiRadioCombination>, ndk::ScopedAStatus>
+    getSupportedRadioCombinationsInternal();
     std::pair<WifiChipCapabilities, ndk::ScopedAStatus> getWifiChipCapabilitiesInternal();
     ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode);
     void retrieveDynamicIfaceCombination();
diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
index f908be6..d0b7014 100644
--- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
@@ -41,7 +41,7 @@
 using aidl::android::hardware::wifi::WifiDebugRingBufferStatus;
 using aidl::android::hardware::wifi::WifiDebugRingBufferVerboseLevel;
 using aidl::android::hardware::wifi::WifiIfaceMode;
-using aidl::android::hardware::wifi::WifiRadioCombinationMatrix;
+using aidl::android::hardware::wifi::WifiRadioCombination;
 using aidl::android::hardware::wifi::WifiStatusCode;
 using aidl::android::hardware::wifi::WifiUsableChannel;
 
@@ -242,14 +242,14 @@
 }
 
 /*
- * GetSupportedRadioCombinationsMatrix
+ * GetSupportedRadioCombinations
  */
-TEST_P(WifiChipAidlTest, GetSupportedRadioCombinationsMatrix) {
-    WifiRadioCombinationMatrix combination_matrix = {};
+TEST_P(WifiChipAidlTest, GetSupportedRadioCombinations) {
+    std::vector<WifiRadioCombination> combinations;
     configureChipForConcurrencyType(IfaceConcurrencyType::STA);
-    auto status = wifi_chip_->getSupportedRadioCombinationsMatrix(&combination_matrix);
+    auto status = wifi_chip_->getSupportedRadioCombinations(&combinations);
     if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) {
-        GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinationsMatrix() "
+        GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinations() "
                         "is not supported by vendor.";
     }
     EXPECT_TRUE(status.isOk());