From b491ffe759fd5500b7d24a253d7dbf9e41a6e871 Mon Sep 17 00:00:00 2001 From: Michael Plass Date: Mon, 11 May 2020 15:59:06 -0700 Subject: Avoid changing wifi mac address when device does not support randomization Devices without a vendor hal do not provide a way for the wifi framework to get the factory mac address, so switching from a random mac to the configured mac requires a reboot. So if mac randomization has not been enabled in the device config, don't attempt to change the mac. Bug: 146507767 Test: atest ClientModeImplTest Change-Id: I53212dc05813001d0ccabeeb4cd491dec06929a4 --- tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 0371a51f6..727922e83 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -2648,7 +2648,7 @@ public class ClientModeImplTest extends WifiBaseTest { * 3. macRandomizationSetting of the WifiConfiguration is RANDOMIZATION_PERSISTENT and * 4. randomized MAC for the network to connect to is different from the current MAC. * - * The factory MAC address is used for the connection. + * The factory MAC address is used for the connection, and no attempt is made to change it. */ @Test public void testConnectedMacRandomizationNotSupported() throws Exception { @@ -2660,6 +2660,8 @@ public class ClientModeImplTest extends WifiBaseTest { connect(); assertEquals(TEST_GLOBAL_MAC_ADDRESS.toString(), mCmi.getWifiInfo().getMacAddress()); + verify(mWifiNative, never()).setMacAddress(any(), any()); + verify(mWifiNative, never()).getFactoryMacAddress(any()); } /** -- cgit v1.2.3