diff options
author | xshu <xshu@google.com> | 2019-04-03 13:13:21 -0700 |
---|---|---|
committer | Oscar Shu <xshu@google.com> | 2019-04-04 16:49:44 +0000 |
commit | 2fe92b76c85f9abc3126116b0be8ff337cfbfdb1 (patch) | |
tree | dd5d7b72cbaf304364b8cabcc44972bedd6c8775 /tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | |
parent | 89bce6ef926ea42e0b77b9098e8bb41b6568c4da (diff) | |
download | android_frameworks_opt_net_wifi-2fe92b76c85f9abc3126116b0be8ff337cfbfdb1.tar.gz android_frameworks_opt_net_wifi-2fe92b76c85f9abc3126116b0be8ff337cfbfdb1.tar.bz2 android_frameworks_opt_net_wifi-2fe92b76c85f9abc3126116b0be8ff337cfbfdb1.zip |
getFactoryMacAddress for devices with no HAL v1.3
Add backward compatibility to older devices by returning the currently
programmed MAC address.
This will mainly affect the "About phone" page.
Bug: 129868071
Test: unit tests
Change-Id: I370b3a07e4d4ec2babe155ba5e32f8bc4dbf0359
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index da710fc63..2da2f691b 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -3314,6 +3314,7 @@ public class ClientModeImplTest { initializeAndAddNetworkAndVerifySuccess(); assertEquals(TEST_GLOBAL_MAC_ADDRESS.toString(), mCmi.getFactoryMacAddress()); verify(mWifiNative).getFactoryMacAddress(WIFI_IFACE_NAME); + verify(mWifiNative).getMacAddress(anyString()); // called once when setting up client mode } /** @@ -3325,6 +3326,22 @@ public class ClientModeImplTest { when(mWifiNative.getFactoryMacAddress(WIFI_IFACE_NAME)).thenReturn(null); assertNull(mCmi.getFactoryMacAddress()); verify(mWifiNative).getFactoryMacAddress(WIFI_IFACE_NAME); + verify(mWifiNative).getMacAddress(anyString()); // called once when setting up client mode + } + + /** + * Verify that when WifiNative#getFactoryMacAddress fails, if the device does not support + * MAC randomization then the currently programmed MAC address gets returned. + */ + @Test + public void testGetFactoryMacAddressFailWithNoMacRandomizationSupport() throws Exception { + mResources.setBoolean(R.bool.config_wifi_connected_mac_randomization_supported, false); + initializeCmi(); + initializeAndAddNetworkAndVerifySuccess(); + when(mWifiNative.getFactoryMacAddress(WIFI_IFACE_NAME)).thenReturn(null); + assertEquals(TEST_GLOBAL_MAC_ADDRESS.toString(), mCmi.getFactoryMacAddress()); + verify(mWifiNative).getFactoryMacAddress(anyString()); + verify(mWifiNative, times(2)).getMacAddress(WIFI_IFACE_NAME); } @Test |