wifi(implementation): Turn on DFS flag for STA

DFS flag needs to be turned on in the legacy HAL for STA operations. So,
initialize this flag on creation of STA iface.
PS: Not adding an explicit HIDL API for this since there is no need to
toggle this from framework and since the HIDL API's are frozen now.

Bug: 36169790
Test: Verified the fix with regression tests: b/37528903.
Change-Id: I214097fcb399cef7fc0cbd2c278622fac259a3e3
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
index 626b195..0b75ccb 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -31,7 +31,14 @@
 WifiStaIface::WifiStaIface(
     const std::string& ifname,
     const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
-    : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+    : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {
+  // Turn on DFS channel usage for STA iface.
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->setDfsFlag(true);
+  if (legacy_status != legacy_hal::WIFI_SUCCESS) {
+    LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable.";
+  }
+}
 
 void WifiStaIface::invalidate() {
   legacy_hal_.reset();