Merge "Populate the disable_events field in the nan_publish_params struct." into main
diff --git a/OWNERS b/OWNERS
index bed29cb..5ddabe7 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,3 +1,4 @@
 etancohen@google.com
 arabawy@google.com
 kumachang@google.com
+include platform/system/core:/janitors/OWNERS #{LAST_RESORT_SUGGESTION}
diff --git a/hostapd/Android.bp b/hostapd/Android.bp
index 4f76a30..5b08d3e 100644
--- a/hostapd/Android.bp
+++ b/hostapd/Android.bp
@@ -451,6 +451,9 @@
     }) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
         true: ["-DCONFIG_IEEE80211AX"],
         default: [],
+    }) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11be"), {
+        true: ["-DCONFIG_IEEE80211BE"],
+        default: [],
     }) + select(soong_config_variable("wpa_supplicant_8", "board_hostapd_config_80211w_mfp_optional"), {
         true: ["-DENABLE_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL"],
         default: [],
@@ -602,6 +605,10 @@
     ] + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
         true: ["src/ap/ieee802_11_he.c"],
         default: [],
+    }) +
+    select(soong_config_variable("wpa_supplicant_8", "hostapd_11be"), {
+        true: ["src/ap/ieee802_11_eht.c"],
+        default: [],
     }),
     defaults: [
         "hostapd_driver_srcs_default",
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index 12d0d9e..0aab000 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -138,6 +138,12 @@
 int32_t aidl_client_version = 0;
 int32_t aidl_service_version = 0;
 
+inline std::array<uint8_t, ETH_ALEN> macAddrToArray(const uint8_t* mac_addr) {
+	std::array<uint8_t, ETH_ALEN> arr;
+	std::copy(mac_addr, mac_addr + ETH_ALEN, std::begin(arr));
+	return arr;
+}
+
 /**
  * Check that the AIDL service is running at least the expected version.
  * Use to avoid the case where the AIDL interface version
@@ -1279,7 +1285,7 @@
 				return hapd;
 		}
 	}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 	return NULL;
 }
 
@@ -1374,7 +1380,7 @@
 						&& strlen(iface_hapd->conf->bridge) == 0) {
 					instanceName = std::to_string(iface_hapd->mld_link_id);
 				}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 				for (const auto& callback : callbacks_) {
 					auto status = callback->onFailure(
 						strlen(iface_hapd->conf->bridge) > 0 ?
@@ -1403,7 +1409,7 @@
 				&& strlen(iface_hapd->conf->bridge) == 0) {
 			instanceName = std::to_string(iface_hapd->mld_link_id);
 		}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 		info.apIfaceInstance = instanceName;
 		info.clientAddress.assign(mac_addr, mac_addr + ETH_ALEN);
 		info.isConnected = authorized;
@@ -1439,7 +1445,7 @@
 			if (iface_hapd->conf->mld_ap && strlen(iface_hapd->conf->bridge) == 0) {
 				instanceName = std::to_string(iface_hapd->mld_link_id);
 			}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 			ApInfo info;
 			info.ifaceName = strlen(iface_hapd->conf->bridge) > 0 ?
 				iface_hapd->conf->bridge : iface_hapd->conf->iface,
@@ -1449,6 +1455,11 @@
 			info.generation = getGeneration(iface_hapd->iface->current_mode);
 			info.apIfaceInstanceMacAddress.assign(iface_hapd->own_addr,
 				iface_hapd->own_addr + ETH_ALEN);
+#ifdef CONFIG_IEEE80211BE
+			if (iface_hapd->conf->mld_ap) {
+				info.mldMacAddress = macAddrToArray(iface_hapd->mld->mld_addr);
+			}
+#endif /* CONFIG_IEEE80211BE */
 			for (const auto &callback : callbacks_) {
 				auto status = callback->onApInstanceInfoChanged(info);
 				if (!status.isOk()) {
@@ -1464,7 +1475,7 @@
 			if (iface_hapd->conf->mld_ap && strlen(iface_hapd->conf->bridge) == 0) {
 				instanceName = std::to_string(iface_hapd->mld_link_id);
 			}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 			// Invoke the failure callback on all registered clients.
 			for (const auto& callback : callbacks_) {
 				auto status =
@@ -1589,6 +1600,7 @@
 ::ndk::ScopedAStatus Hostapd::removeLinkFromMultipleLinkBridgedApIfaceInternal(
 const std::string& iface_name, const std::string& linkIdentity)
 {
+#ifdef CONFIG_IEEE80211BE
 	if (!hostapd_get_iface(interfaces_, iface_name.c_str())) {
 		wpa_printf(MSG_ERROR, "Interface %s doesn't exist", iface_name.c_str());
 		return createStatus(HostapdStatusCode::FAILURE_IFACE_UNKNOWN);
@@ -1596,11 +1608,18 @@
 	struct hostapd_data* iface_hapd =
 		hostapd_get_iface_by_link_id(interfaces_, (size_t) linkIdentity.c_str());
 	if (iface_hapd) {
+// Currently, hostapd_link_remove is still under CONFIG_TESTING_OPTIONS.
+// TODO: b/340821197 - Make sure to take out the hostapd_link_remove() and other related code
+// out of CONFIG_TESTING_OPTIONS.
+#ifdef CONFIG_TESTING_OPTIONS
 		if (0 == hostapd_link_remove(iface_hapd, 1)) {
 			return ndk::ScopedAStatus::ok();
 		}
+#endif /* CONFIG_TESTING_OPTIONS */
 	}
 	return createStatus(HostapdStatusCode::FAILURE_ARGS_INVALID);
+#endif /* CONFIG_IEEE80211BE */
+	return createStatus(HostapdStatusCode::FAILURE_UNKNOWN);
 }
 
 }  // namespace hostapd
diff --git a/wpa_supplicant/aidl/mainline/usd_iface.cpp b/wpa_supplicant/aidl/mainline/usd_iface.cpp
new file mode 100644
index 0000000..b514f77
--- /dev/null
+++ b/wpa_supplicant/aidl/mainline/usd_iface.cpp
@@ -0,0 +1,43 @@
+/*
+ * WPA Supplicant - Interface for USD operations
+ * Copyright (c) 2024, Google Inc. All rights reserved.
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "usd_iface.h"
+
+UsdIface::UsdIface(struct wpa_global* wpa_global, std::string iface_name)
+    : wpa_global_(wpa_global), iface_name_(iface_name) {}
+
+::ndk::ScopedAStatus UsdIface::getUsdCapabilities(UsdCapabilities* _aidl_return) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UsdIface::startUsdPublish(int32_t in_cmdId,
+        const PublishConfig& in_usdPublishConfig) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UsdIface::startUsdSubscribe(int32_t in_cmdId,
+        const SubscribeConfig& in_usdSubscribeConfig) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UsdIface::updateUsdPublish(int32_t in_publishId,
+        const std::vector<uint8_t>& in_serviceSpecificInfo) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UsdIface::cancelUsdPublish(int32_t in_publishId) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UsdIface::cancelUsdSubscribe(int32_t in_subscribeId) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UsdIface::sendUsdMessage(const UsdMessageInfo& in_messageInfo) {
+    return ndk::ScopedAStatus::ok();
+}
diff --git a/wpa_supplicant/aidl/mainline/usd_iface.h b/wpa_supplicant/aidl/mainline/usd_iface.h
new file mode 100644
index 0000000..32b86cc
--- /dev/null
+++ b/wpa_supplicant/aidl/mainline/usd_iface.h
@@ -0,0 +1,36 @@
+/*
+ * WPA Supplicant - Interface for USD operations
+ * Copyright (c) 2024, Google Inc. All rights reserved.
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef MAINLINE_SUPPLICANT_USD_IFACE_H
+#define MAINLINE_SUPPLICANT_USD_IFACE_H
+
+#include <aidl/android/system/wifi/mainline_supplicant/BnUsdInterface.h>
+
+using ::aidl::android::system::wifi::mainline_supplicant::BnUsdInterface;
+using ::aidl::android::system::wifi::mainline_supplicant::UsdMessageInfo;
+
+class UsdIface : public BnUsdInterface {
+    public:
+        UsdIface(struct wpa_global* wpa_global, std::string iface_name);
+        ::ndk::ScopedAStatus getUsdCapabilities(UsdCapabilities* _aidl_return) override;
+        ::ndk::ScopedAStatus startUsdPublish(int32_t in_cmdId,
+            const PublishConfig& in_usdPublishConfig) override;
+        ::ndk::ScopedAStatus startUsdSubscribe(int32_t in_cmdId,
+            const SubscribeConfig& in_usdSubscribeConfig) override;
+        ::ndk::ScopedAStatus updateUsdPublish(int32_t in_publishId,
+            const std::vector<uint8_t>& in_serviceSpecificInfo) override;
+        ::ndk::ScopedAStatus cancelUsdPublish(int32_t in_publishId) override;
+        ::ndk::ScopedAStatus cancelUsdSubscribe(int32_t in_subscribeId) override;
+        ::ndk::ScopedAStatus sendUsdMessage(const UsdMessageInfo& in_messageInfo) override;
+
+    private:
+        wpa_global* wpa_global_;
+        std::string iface_name_;
+};
+
+#endif // MAINLINE_SUPPLICANT_USD_IFACE_H