diff options
author | xshu <xshu@google.com> | 2019-04-08 20:35:52 -0700 |
---|---|---|
committer | xshu <xshu@google.com> | 2019-04-08 20:38:52 -0700 |
commit | 2da6fd19c297dac6a0bd93d5a93470bce758f106 (patch) | |
tree | 53fa9d658c55f00fd15fdb14aac525acbdfcf2af | |
parent | 89bce6ef926ea42e0b77b9098e8bb41b6568c4da (diff) |
Remove unused setMacAddress in WificondControl
All setMacAddress operations are done through the Vendor Hal
Cleaning up unused code
Bug: 76176702
Test: unit tests
Test: flash and boot
Change-Id: Ia9facb4fa8535c5ac201046ab29b481134d6335c
-rw-r--r-- | service/java/com/android/server/wifi/WificondControl.java | 24 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WificondControlTest.java | 23 |
2 files changed, 0 insertions, 47 deletions
diff --git a/service/java/com/android/server/wifi/WificondControl.java b/service/java/com/android/server/wifi/WificondControl.java index 589ede001..c58c56471 100644 --- a/service/java/com/android/server/wifi/WificondControl.java +++ b/service/java/com/android/server/wifi/WificondControl.java @@ -18,7 +18,6 @@ package com.android.server.wifi; import android.annotation.NonNull; import android.app.AlarmManager; -import android.net.MacAddress; import android.net.wifi.IApInterface; import android.net.wifi.IApInterfaceEventCallback; import android.net.wifi.IClientInterface; @@ -865,29 +864,6 @@ public class WificondControl implements IBinder.DeathRecipient { } /** - * Set Mac address on the given interface - * @param interfaceName Name of the interface. - * @param mac Mac address to change into - * @return true on success, false otherwise. - */ - public boolean setMacAddress(@NonNull String interfaceName, @NonNull MacAddress mac) { - IClientInterface mClientInterface = getClientInterface(interfaceName); - if (mClientInterface == null) { - Log.e(TAG, "No valid wificond client interface handler"); - return false; - } - byte[] macByteArray = mac.toByteArray(); - - try { - mClientInterface.setMacAddress(macByteArray); - } catch (RemoteException e) { - Log.e(TAG, "Failed to setMacAddress due to remote exception"); - return false; - } - return true; - } - - /** * See {@link WifiNative#sendMgmtFrame(String, byte[], SendMgmtFrameCallback, int)} */ public void sendMgmtFrame(@NonNull String ifaceName, @NonNull byte[] frame, diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java index 85fbc077e..ca48f38ae 100644 --- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java @@ -39,7 +39,6 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import android.app.AlarmManager; -import android.net.MacAddress; import android.net.wifi.IApInterface; import android.net.wifi.IApInterfaceEventCallback; import android.net.wifi.IClientInterface; @@ -195,7 +194,6 @@ public class WificondControlTest { networkList[1].flags = 0; networkList[1].frequencies = TEST_FREQUENCIES_2; }}; - private static final MacAddress TEST_MAC_ADDRESS = MacAddress.fromString("ee:33:a2:94:10:92"); private static final int TEST_MCS_RATE = 5; private static final int TEST_SEND_MGMT_FRAME_ELAPSED_TIME_MS = 100; @@ -977,27 +975,6 @@ public class WificondControlTest { } /** - * Verifies setMacAddress() success. - */ - @Test - public void testSetMacAddressSuccess() throws Exception { - byte[] macByteArray = TEST_MAC_ADDRESS.toByteArray(); - assertTrue(mWificondControl.setMacAddress(TEST_INTERFACE_NAME, TEST_MAC_ADDRESS)); - verify(mClientInterface).setMacAddress(macByteArray); - } - - /** - * Verifies setMacAddress() can handle failure. - */ - @Test - public void testSetMacAddressFailDueToExceptionInInterface() throws Exception { - byte[] macByteArray = TEST_MAC_ADDRESS.toByteArray(); - doThrow(new RemoteException()).when(mClientInterface).setMacAddress(macByteArray); - assertFalse(mWificondControl.setMacAddress(TEST_INTERFACE_NAME, TEST_MAC_ADDRESS)); - verify(mClientInterface).setMacAddress(macByteArray); - } - - /** * sendMgmtFrame() should fail if a null callback is passed in. */ @Test |