Merge "Added seek unit tests for default bcradio HAL" into main
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index d95de0d..5cb0158 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -237,8 +237,10 @@
                             {RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_STATE,
                              RadioError::SIM_ABSENT, RadioError::INTERNAL_ERR, RadioError::NONE});
 
-    ASSERT_TRUE(radioRsp_network->usageSetting == UsageSetting::VOICE_CENTRIC ||
-                radioRsp_network->usageSetting == UsageSetting::DATA_CENTRIC);
+    if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+        ASSERT_TRUE(radioRsp_network->usageSetting == UsageSetting::VOICE_CENTRIC ||
+                    radioRsp_network->usageSetting == UsageSetting::DATA_CENTRIC);
+    }
 }
 
 void RadioNetworkTest::testSetUsageSetting_InvalidValues(std::vector<RadioError> errors) {
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
index 2e22807..69a8919 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
@@ -36,8 +36,10 @@
 using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface;
 using aidl::android::hardware::wifi::supplicant::MiracastMode;
 using aidl::android::hardware::wifi::supplicant::P2pConnectInfo;
+using aidl::android::hardware::wifi::supplicant::P2pCreateGroupOwnerInfo;
 using aidl::android::hardware::wifi::supplicant::P2pDeviceFoundEventParams;
 using aidl::android::hardware::wifi::supplicant::P2pDiscoveryInfo;
+using aidl::android::hardware::wifi::supplicant::P2pExtListenInfo;
 using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask;
 using aidl::android::hardware::wifi::supplicant::P2pGoNegotiationReqEventParams;
 using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask;
@@ -72,7 +74,7 @@
 const uint32_t kTestGroupFreq = 0;
 const bool kTestGroupPersistent = false;
 const bool kTestGroupIsJoin = false;
-const auto& kTestVendorData = generateOuiKeyedDataList(5);
+const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);
 
 }  // namespace
 
@@ -535,6 +537,22 @@
 }
 
 /*
+ * CreateGroupOwner
+ */
+TEST_P(SupplicantP2pIfaceAidlTest, CreateGroupOwner) {
+    if (interface_version_ < 3) {
+        GTEST_SKIP() << "createGroupOwner is available as of Supplicant V3";
+    }
+
+    P2pCreateGroupOwnerInfo info;
+    info.persistent = false;
+    info.persistentNetworkId = kTestNetworkId;
+    info.vendorData = kTestVendorDataOptional;
+
+    EXPECT_TRUE(p2p_iface_->createGroupOwner(info).isOk());
+}
+
+/*
  * Find
  */
 TEST_P(SupplicantP2pIfaceAidlTest, Find) {
@@ -565,7 +583,7 @@
 
     P2pDiscoveryInfo discoveryParams;
     discoveryParams.timeoutInSec = kTestFindTimeout;
-    discoveryParams.vendorData = kTestVendorData;
+    discoveryParams.vendorData = kTestVendorDataOptional;
 
     discoveryParams.scanType = P2pScanType::FULL;
     EXPECT_TRUE(p2p_iface_->findWithParams(discoveryParams).isOk());
@@ -624,7 +642,7 @@
     connectInfo.joinExistingGroup = true;
     connectInfo.persistent = false;
     connectInfo.goIntent = kTestConnectGoIntent;
-    connectInfo.vendorData = kTestVendorData;
+    connectInfo.vendorData = kTestVendorDataOptional;
 
     std::string pin;
     EXPECT_TRUE(p2p_iface_->connectWithParams(connectInfo, &pin).isOk());
@@ -690,6 +708,22 @@
 }
 
 /*
+ * ConfigureExtListenWithParams
+ */
+TEST_P(SupplicantP2pIfaceAidlTest, ConfigureExtListenWithParams) {
+    if (interface_version_ < 3) {
+        GTEST_SKIP() << "configureExtListenWithParams is available as of Supplicant V3";
+    }
+
+    P2pExtListenInfo info;
+    info.periodMs = 400;
+    info.intervalMs = 400;
+    info.vendorData = kTestVendorDataOptional;
+
+    EXPECT_TRUE(p2p_iface_->configureExtListenWithParams(info).isOk());
+}
+
+/*
  * FlushServices
  */
 TEST_P(SupplicantP2pIfaceAidlTest, FlushServices) {
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp
index e5e9735..a541f8f 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp
@@ -72,6 +72,7 @@
 const KeyMgmtMask kTestKeyMgmt =
     static_cast<KeyMgmtMask>(static_cast<uint32_t>(KeyMgmtMask::WPA_PSK) |
                              static_cast<uint32_t>(KeyMgmtMask::WPA_EAP));
+const auto& kTestVendorData = generateOuiKeyedDataList(5);
 
 }  // namespace
 
@@ -834,6 +835,16 @@
     EXPECT_TRUE(sta_network_->disableEht().isOk());
 }
 
+/*
+ * SetVendorData
+ */
+TEST_P(SupplicantStaNetworkAidlTest, SetVendorData) {
+    if (interface_version_ < 3) {
+        GTEST_SKIP() << "setVendorData is available as of Supplicant V3";
+    }
+    EXPECT_TRUE(sta_network_->setVendorData(kTestVendorData).isOk());
+}
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkAidlTest);
 INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantStaNetworkAidlTest,
                          testing::ValuesIn(android::getAidlHalInstanceNames(
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h
index b38e669..51793fd 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h
@@ -102,7 +102,7 @@
     return arrayAddr;
 }
 
-std::optional<OuiKeyedData> generateOuiKeyedData(int oui) {
+OuiKeyedData generateOuiKeyedData(int oui) {
     PersistableBundle bundle;
     bundle.putString("stringKey", "stringValue");
     bundle.putInt("intKey", 12345);
@@ -110,13 +110,27 @@
     OuiKeyedData data;
     data.oui = oui;
     data.vendorData = bundle;
-    return std::optional<OuiKeyedData>{data};
+    return data;
 }
 
-std::optional<std::vector<std::optional<OuiKeyedData>>> generateOuiKeyedDataList(int size) {
-    std::vector<std::optional<OuiKeyedData>> dataList;
+std::vector<OuiKeyedData> generateOuiKeyedDataList(int size) {
+    std::vector<OuiKeyedData> dataList;
     for (int i = 0; i < size; i++) {
         dataList.push_back(generateOuiKeyedData(i + 1));
     }
+    return dataList;
+}
+
+// Wraps generateOuiKeyedData result in std::optional
+std::optional<OuiKeyedData> generateOuiKeyedDataOptional(int oui) {
+    return std::optional<OuiKeyedData>{generateOuiKeyedData(oui)};
+}
+
+// Generate OuiKeyedData list fully wrapped in std::optional
+std::optional<std::vector<std::optional<OuiKeyedData>>> generateOuiKeyedDataListOptional(int size) {
+    std::vector<std::optional<OuiKeyedData>> dataList;
+    for (int i = 0; i < size; i++) {
+        dataList.push_back(generateOuiKeyedDataOptional(i + 1));
+    }
     return std::optional<std::vector<std::optional<OuiKeyedData>>>{dataList};
 }