Add the USD dependencies to wpa_supplicant_defaults
and remove the workaround in sta_iface.cpp

This cc_defaults is used by some targets like
Cuttlefish.

Bug: 384527237
Test: Treehugger builds
Change-Id: I4228af5595758187ef1943e1ec76153f7976a3b5
diff --git a/wpa_supplicant/Android.bp b/wpa_supplicant/Android.bp
index f2fb64f..fb74517 100644
--- a/wpa_supplicant/Android.bp
+++ b/wpa_supplicant/Android.bp
@@ -150,6 +150,7 @@
         "-DCONFIG_IPV6",
         "-DCONFIG_JSON",
         "-DCONFIG_MBO",
+        "-DCONFIG_NAN_USD",
         "-DCONFIG_NO_ACCOUNTING",
         "-DCONFIG_NO_RADIUS",
         "-DCONFIG_NO_RADIUS",
@@ -290,6 +291,7 @@
         "interworking.c",
         "main.c",
         "mbo.c",
+        "nan_usd.c",
         "notify.c",
         "offchannel.c",
         "op_classes.c",
@@ -326,6 +328,7 @@
         "src/ap/ieee802_11_vht.c",
         "src/ap/ieee802_1x.c",
         "src/ap/mbo_ap.c",
+        "src/ap/nan_usd_ap.c",
         "src/ap/neighbor_db.c",
         "src/ap/p2p_hostapd.c",
         "src/ap/pmksa_cache_auth.c",
@@ -351,6 +354,7 @@
         "src/common/gas_server.c",
         "src/common/hw_features_common.c",
         "src/common/ieee802_11_common.c",
+        "src/common/nan_de.c",
         "src/common/sae.c",
         "src/common/sae_pk.c",
         "src/common/wpa_common.c",
diff --git a/wpa_supplicant/aidl/vendor/sta_iface.cpp b/wpa_supplicant/aidl/vendor/sta_iface.cpp
index b78eed6..9e76f56 100644
--- a/wpa_supplicant/aidl/vendor/sta_iface.cpp
+++ b/wpa_supplicant/aidl/vendor/sta_iface.cpp
@@ -2763,9 +2763,6 @@
 	return {capabilities, ndk::ScopedAStatus::ok()};
 }
 
-// TODO (b/384527237): Fix linker error to avoid having a separate default implementation
-#ifdef CONFIG_NAN_USD
-
 ndk::ScopedAStatus StaIface::startUsdPublishInternal(
 		int32_t cmdId, const UsdPublishConfig& usdPublishConfig) {
 	if (!validateUsdPublishConfig(usdPublishConfig)) {
@@ -2796,7 +2793,7 @@
 	if (publishId < 0) {
 		wpa_printf(MSG_INFO, "Failed to configure USD publish");
 		aidl_manager->notifyUsdPublishConfigFailed(
-			wpa_s, cmdId, UsdConfigErrorCode::FAILURE_UNKNOWN);
+			wpa_s, cmdId, ISupplicantStaIfaceCallback::UsdConfigErrorCode::FAILURE_UNKNOWN);
 		return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
 	}
 	aidl_manager->notifyUsdPublishStarted(wpa_s, cmdId, publishId);
@@ -2831,7 +2828,7 @@
 	if (subscribeId < 0) {
 		wpa_printf(MSG_INFO, "Failed to configure USD subscribe");
 		aidl_manager->notifyUsdSubscribeConfigFailed(
-			wpa_s, cmdId, UsdConfigErrorCode::FAILURE_UNKNOWN);
+			wpa_s, cmdId, ISupplicantStaIfaceCallback::UsdConfigErrorCode::FAILURE_UNKNOWN);
 		return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
 	}
 	aidl_manager->notifyUsdSubscribeStarted(wpa_s, cmdId, subscribeId);
@@ -2895,37 +2892,6 @@
 	return ndk::ScopedAStatus::ok();
 }
 
-#else /* CONFIG_NAN_USD */
-
-ndk::ScopedAStatus StaIface::startUsdPublishInternal(
-		int32_t cmdId, const UsdPublishConfig& usdPublishConfig) {
-	return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
-}
-
-ndk::ScopedAStatus StaIface::startUsdSubscribeInternal(
-		int32_t cmdId, const UsdSubscribeConfig& usdSubscribeConfig) {
-	return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
-}
-
-::ndk::ScopedAStatus StaIface::updateUsdPublishInternal(int32_t publishId,
-		const std::vector<uint8_t>& serviceSpecificInfo) {
-	return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
-}
-
-::ndk::ScopedAStatus StaIface::cancelUsdPublishInternal(int32_t publishId) {
-	return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
-}
-
-::ndk::ScopedAStatus StaIface::cancelUsdSubscribeInternal(int32_t subscribeId) {
-	return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
-}
-
-::ndk::ScopedAStatus StaIface::sendUsdMessageInternal(const UsdMessageInfo& messageInfo) {
-	return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
-}
-
-#endif /* CONFIG_NAN_USD */
-
 /**
  * Retrieve the underlying |wpa_supplicant| struct
  * pointer for this iface.