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.cpp b/wifi/1.3/default/wifi_ap_iface.cpp
index c203e47..025ece3 100644
--- a/wifi/1.3/default/wifi_ap_iface.cpp
+++ b/wifi/1.3/default/wifi_ap_iface.cpp
@@ -30,8 +30,12 @@
WifiApIface::WifiApIface(
const std::string& ifname,
- const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
- : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
+ const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util)
+ : ifname_(ifname),
+ legacy_hal_(legacy_hal),
+ iface_util_(iface_util),
+ is_valid_(true) {}
void WifiApIface::invalidate() {
legacy_hal_.reset();