wifi(implementation): Move set/getMacaddress to a util class

This is just a refactor to move the setMacAddress & getFactoryMacAddress
methods to a util class within the HAL. This can be then reused in AP
iface for mac randomization of SoftAp.

This also fixes a bug in the existing setMacAddress() method, the
current method always sets wlan0 up/down. STA interface could be wlan1
on some devices.

Bug: 78353419
Test: ./hardware/interfaces/wifi/1.3/default/tests/runtests.sh
Test: Manually verified STA MAC randomization still works.
Change-Id: I0bb8154f7e6dcae37c977454423c8c299762260e
diff --git a/wifi/1.3/default/wifi_ap_iface.h b/wifi/1.3/default/wifi_ap_iface.h
index 9f3d870..6dbfc18 100644
--- a/wifi/1.3/default/wifi_ap_iface.h
+++ b/wifi/1.3/default/wifi_ap_iface.h
@@ -20,6 +20,8 @@
 #include <android-base/macros.h>
 #include <android/hardware/wifi/1.0/IWifiApIface.h>
 
+#include "wifi_iface_util.h"
+
 #include "wifi_legacy_hal.h"
 
 namespace android {
@@ -35,7 +37,8 @@
 class WifiApIface : public V1_0::IWifiApIface {
    public:
     WifiApIface(const std::string& ifname,
-                const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
+                const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
+                const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util);
     // Refer to |WifiChip::invalidate()|.
     void invalidate();
     bool isValid();
@@ -59,6 +62,7 @@
 
     std::string ifname_;
     std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
+    std::weak_ptr<iface_util::WifiIfaceUtil> iface_util_;
     bool is_valid_;
 
     DISALLOW_COPY_AND_ASSIGN(WifiApIface);