Wifi AP: Remove HAL-level MAC randomization
Randomization will be handled by framework code instead. This also means
WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION is replaced with a
framework config option (config_wifi_ap_mac_randomization_supported),
which can be set from device overlays.
Bug: 142387520
Test: atest android.hardware.wifi@1.0-service-tests; adb shell LD_LIBRARY_PATH=:/system/lib64/vndk-R /data/local/tmp/android.hardware.wifi@1.0-service-tests/x86_64/android.hardware.wifi@1.0-service-tests
Test: vts-tradefed run vts --primary-abi-only --skip-device-info -l DEBUG --include-filter VtsHalWifiApV1_4Target
Test: lunch hawk-userdebug; m (uses DISABLE_AP_MAC_RANDOMIZATION)
Change-Id: I2dbf1158368ce3c39980501f892c6de1ffb3f748
diff --git a/wifi/1.4/default/wifi_ap_iface.cpp b/wifi/1.4/default/wifi_ap_iface.cpp
index b860910..e677f19 100644
--- a/wifi/1.4/default/wifi_ap_iface.cpp
+++ b/wifi/1.4/default/wifi_ap_iface.cpp
@@ -31,26 +31,11 @@
WifiApIface::WifiApIface(
const std::string& ifname,
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
- const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util,
- const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags)
+ const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util)
: ifname_(ifname),
legacy_hal_(legacy_hal),
iface_util_(iface_util),
- feature_flags_(feature_flags),
- is_valid_(true) {
- if (feature_flags_.lock()->isApMacRandomizationDisabled()) {
- LOG(INFO) << "AP MAC randomization disabled";
- return;
- }
- LOG(INFO) << "AP MAC randomization enabled";
- // Set random MAC address
- std::array<uint8_t, 6> randomized_mac =
- iface_util_.lock()->getOrCreateRandomMacAddress();
- bool status = iface_util_.lock()->setMacAddress(ifname_, randomized_mac);
- if (!status) {
- LOG(ERROR) << "Failed to set random mac address";
- }
-}
+ is_valid_(true) {}
void WifiApIface::invalidate() {
legacy_hal_.reset();