diff options
author | lesl <lesl@google.com> | 2020-11-17 22:58:24 +0800 |
---|---|---|
committer | lesl <lesl@google.com> | 2020-11-25 13:37:52 +0800 |
commit | e8ff42ba1fcac00f7bdfd719798288ce7aaa73af (patch) | |
tree | 9b181d7598a7249a8974f40ea341fdf261101475 | |
parent | 9f37dc2feb68e3048e7ba0398f3d7ad7a38f97b9 (diff) | |
download | wifi-e8ff42ba1fcac00f7bdfd719798288ce7aaa73af.tar.gz |
wifi: Add AP bridge operations support (AP+AP Part 2)
AP+AP Part 2 includes:
1. Support bridge in libwifi_system_iface
2. WifiHal API
a. createBridgedApIface (Support create bridge mode AP)
b. removeIfaceInstanceFromBridgedApIface
(Support remove one of the instance in bridge)
3. Framework:
Create bridge AP when multi-bands configured.
Bug: 162686273
Test: atest FrameworksWifiTests
Test: Manual Test (SAP enable normally)
Change-Id: I05ca0e731c4544c8f492319e4631a27c82d3a462
8 files changed, 191 insertions, 101 deletions
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java index 486bb3d79..90b3953ca 100644 --- a/service/java/com/android/server/wifi/HalDeviceManager.java +++ b/service/java/com/android/server/wifi/HalDeviceManager.java @@ -300,9 +300,10 @@ public class HalDeviceManager { public IWifiApIface createApIface( long requiredChipCapabilities, @Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler, - @NonNull WorkSource requestorWs) { - return (IWifiApIface) createIface(HDM_CREATE_IFACE_AP, requiredChipCapabilities, - destroyedListener, handler, requestorWs); + @NonNull WorkSource requestorWs, boolean isBridged) { + return (IWifiApIface) createIface(isBridged ? HDM_CREATE_IFACE_AP_BRIDGE + : HDM_CREATE_IFACE_AP, requiredChipCapabilities, destroyedListener, + handler, requestorWs); } /** @@ -310,9 +311,9 @@ public class HalDeviceManager { */ public IWifiApIface createApIface( @Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler, - @NonNull WorkSource requestorWs) { + @NonNull WorkSource requestorWs, boolean isBridged) { return (IWifiApIface) createApIface(CHIP_CAPABILITY_ANY, - destroyedListener, handler, requestorWs); + destroyedListener, handler, requestorWs, isBridged); } /** @@ -2155,6 +2156,20 @@ public class HalDeviceManager { ifaceResp.value = iface; }); break; + case HDM_CREATE_IFACE_AP_BRIDGE: + android.hardware.wifi.V1_5.IWifiChip chip15 = + getWifiChipForV1_5Mockable(ifaceCreationData.chipInfo.chip); + if (chip15 != null) { + chip15.createBridgedApIface( + (WifiStatus status, IWifiApIface iface) -> { + statusResp.value = status; + ifaceResp.value = iface; + }); + } else { + Log.e(TAG, "Hal doesn't support to create AP bridge mode"); + statusResp.value.code = WifiStatusCode.ERROR_NOT_SUPPORTED; + } + break; case HDM_CREATE_IFACE_AP: ifaceCreationData.chipInfo.chip.createApIface( (WifiStatus status, IWifiApIface iface) -> { diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java index 1fc450324..621a60c5e 100644 --- a/service/java/com/android/server/wifi/SoftApManager.java +++ b/service/java/com/android/server/wifi/SoftApManager.java @@ -439,11 +439,6 @@ public class SoftApManager implements ActiveModeManager { */ private int startSoftAp() { SoftApConfiguration config = mApConfig.getSoftApConfiguration(); - if (config == null || config.getSsid() == null) { - Log.e(getTag(), "Unable to start soft AP without valid configuration"); - return ERROR_GENERIC; - } - Log.d(getTag(), "band " + config.getBand() + " iface " + mApInterfaceName + " country " + mCountryCode); @@ -648,8 +643,20 @@ public class SoftApManager implements ActiveModeManager { break; case CMD_START: mRequestorWs = (WorkSource) message.obj; + SoftApConfiguration config = mApConfig.getSoftApConfiguration(); + if (config == null || config.getSsid() == null) { + Log.e(getTag(), "Unable to start soft AP without valid configuration"); + updateApState(WifiManager.WIFI_AP_STATE_FAILED, + WifiManager.WIFI_AP_STATE_DISABLED, + WifiManager.SAP_START_FAILURE_GENERAL); + mWifiMetrics.incrementSoftApStartResult( + false, WifiManager.SAP_START_FAILURE_GENERAL); + mModeListener.onStartFailure(SoftApManager.this); + break; + } mApInterfaceName = mWifiNative.setupInterfaceForSoftApMode( - mWifiNativeInterfaceCallback, mRequestorWs); + mWifiNativeInterfaceCallback, mRequestorWs, + mApConfig.getSoftApConfiguration().getBands().length > 1); if (TextUtils.isEmpty(mApInterfaceName)) { Log.e(getTag(), "setup failure when creating ap interface."); updateApState(WifiManager.WIFI_AP_STATE_FAILED, diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index b7909408b..dd8ebe0ed 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -897,11 +897,12 @@ public class WifiNative { * For devices which do not the support the HAL, this will bypass HalDeviceManager & * teardown any existing iface. */ - private String createApIface(@NonNull Iface iface, @NonNull WorkSource requestorWs) { + private String createApIface(@NonNull Iface iface, @NonNull WorkSource requestorWs, + boolean isBridged) { synchronized (mLock) { if (mWifiVendorHal.isVendorHalSupported()) { return mWifiVendorHal.createApIface( - new InterfaceDestoyedListenerInternal(iface.id), requestorWs); + new InterfaceDestoyedListenerInternal(iface.id), requestorWs, isBridged); } else { Log.i(TAG, "Vendor Hal not supported, ignoring createApIface."); return handleIfaceCreationWhenVendorHalNotSupported(iface); @@ -1174,10 +1175,12 @@ public class WifiNative { * * @param interfaceCallback Associated callback for notifying status changes for the iface. * @param requestorWs Requestor worksource. + * @param isBridged Whether or not AP interface is a bridge interface. * @return Returns the name of the allocated interface, will be null on failure. */ public String setupInterfaceForSoftApMode( - @NonNull InterfaceCallback interfaceCallback, @NonNull WorkSource requestorWs) { + @NonNull InterfaceCallback interfaceCallback, @NonNull WorkSource requestorWs, + boolean isBridged) { synchronized (mLock) { if (!startHal()) { Log.e(TAG, "Failed to start Hal"); @@ -1195,7 +1198,7 @@ public class WifiNative { return null; } iface.externalListener = interfaceCallback; - iface.name = createApIface(iface, requestorWs); + iface.name = createApIface(iface, requestorWs, isBridged); if (TextUtils.isEmpty(iface.name)) { Log.e(TAG, "Failed to create AP iface in vendor HAL"); mIfaceMgr.removeIface(iface.id); diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java index 759430c5b..8cb674e92 100644 --- a/service/java/com/android/server/wifi/WifiVendorHal.java +++ b/service/java/com/android/server/wifi/WifiVendorHal.java @@ -333,7 +333,7 @@ public class WifiVendorHal { if (!startVendorHal()) { return false; } - if (TextUtils.isEmpty(createApIface(null, null))) { + if (TextUtils.isEmpty(createApIface(null, null, false))) { stopVendorHal(); return false; } @@ -507,14 +507,15 @@ public class WifiVendorHal { * * @param destroyedListener Listener to be invoked when the interface is destroyed. * @param requestorWs Requestor worksource. + * @param isBridged Whether or not AP interface is a bridge interface. * @return iface name on success, null otherwise. */ public String createApIface(@Nullable InterfaceDestroyedListener destroyedListener, - @NonNull WorkSource requestorWs) { + @NonNull WorkSource requestorWs, boolean isBridged) { synchronized (sLock) { IWifiApIface iface = mHalDeviceManager.createApIface( new ApInterfaceDestroyedListenerInternal(destroyedListener), null, - requestorWs); + requestorWs, isBridged); if (iface == null) { mLog.err("Failed to create AP iface").flush(); return stringResult(null); diff --git a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java index c4840de20..73ca219b9 100644 --- a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java @@ -17,6 +17,7 @@ package com.android.server.wifi; import static com.android.server.wifi.HalDeviceManager.HDM_CREATE_IFACE_AP; +import static com.android.server.wifi.HalDeviceManager.HDM_CREATE_IFACE_AP_BRIDGE; import static com.android.server.wifi.HalDeviceManager.HDM_CREATE_IFACE_NAN; import static com.android.server.wifi.HalDeviceManager.HDM_CREATE_IFACE_P2P; import static com.android.server.wifi.HalDeviceManager.HDM_CREATE_IFACE_STA; @@ -702,7 +703,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { // get AP interface from a system app: should fail when(mWorkSourceHelper1.hasAnyPrivilegedAppRequest()).thenReturn(false); when(mWorkSourceHelper1.hasAnySystemAppRequest()).thenReturn(true); - IWifiApIface apIface = mDut.createApIface(null, null, TEST_WORKSOURCE_1); + IWifiApIface apIface = mDut.createApIface(null, null, TEST_WORKSOURCE_1, false); collector.checkThat("not allocated interface", apIface, IsNull.nullValue()); // Now replace the requestorWs (fg app now) for the STA iface. @@ -952,8 +953,9 @@ public class HalDeviceManagerTest extends WifiBaseTest { doAnswer(new GetTypeAnswer(IfaceType.AP)).when(apIface).getType( any(IWifiIface.getTypeCallback.class)); doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, apIface)).when( - chipMock.chip).createApIface(any(IWifiChip.createApIfaceCallback.class)); - assertEquals(apIface, mDut.createApIface(apIdl, null, TEST_WORKSOURCE_0)); + chipMock.chip).createApIface( + any(IWifiChip.createApIfaceCallback.class)); + assertEquals(apIface, mDut.createApIface(apIdl, null, TEST_WORKSOURCE_0, false)); mInOrder.verify(chipMock.chip).removeStaIface(getName(staIface)); mInOrder.verify(staIdl).onDestroyed(getName(staIface)); @@ -1338,7 +1340,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2 (system app): should fail - IWifiIface apIface2 = mDut.createApIface(null, null, TEST_WORKSOURCE_0); + IWifiIface apIface2 = mDut.createApIface(null, null, TEST_WORKSOURCE_0, false); collector.checkThat("AP2 should not be created", apIface2, IsNull.nullValue()); // tear down AP @@ -1732,7 +1734,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2 (system app): should fail - IWifiIface apIface2 = mDut.createApIface(null, null, TEST_WORKSOURCE_0); + IWifiIface apIface2 = mDut.createApIface(null, null, TEST_WORKSOURCE_0, false); collector.checkThat("AP2 should not be created", apIface2, IsNull.nullValue()); // request P2P (system app): should fail @@ -2032,7 +2034,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2 (system app): should fail - IWifiIface apIface2 = mDut.createApIface(null, null, TEST_WORKSOURCE_0); + IWifiIface apIface2 = mDut.createApIface(null, null, TEST_WORKSOURCE_0, false); collector.checkThat("AP2 should not be created", apIface2, IsNull.nullValue()); // request P2P (system app): should fail @@ -2283,8 +2285,13 @@ public class HalDeviceManagerTest extends WifiBaseTest { long requiredChipCapabilities = android.hardware.wifi.V1_5.IWifiChip.ChipCapabilityMask.WIGIG; chipMock.initialize(); - mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, - mManagerStatusListenerMock); + if (mWifiChipV15 != null) { + mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, + mWifiChipV15, mManagerStatusListenerMock); + } else { + mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, + mManagerStatusListenerMock); + } executeAndValidateInitializationSequence(); executeAndValidateStartupSequence(); @@ -2331,7 +2338,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { collector.checkThat("AP created", apIface, IsNull.notNullValue()); } else { apIface = mDut.createApIface( - requiredChipCapabilities, null, null, TEST_WORKSOURCE_0); + requiredChipCapabilities, null, null, TEST_WORKSOURCE_0, false); collector.checkThat("AP should not be created", apIface, IsNull.nullValue()); } @@ -2377,6 +2384,27 @@ public class HalDeviceManagerTest extends WifiBaseTest { chipMock, TestChipV4.CHIP_MODE_ID, TestChipV4.CHIP_MODE_ID, true); } + /** + * Validate creation of AP interface from blank start-up in chip V1.5 + */ + @Test + public void testCreateApInterfaceNoInitModeTestChipV15() throws Exception { + mWifiChipV15 = mock(android.hardware.wifi.V1_5.IWifiChip.class); + runCreateSingleXxxInterfaceNoInitMode(new TestChipV5(), HDM_CREATE_IFACE_AP, "wlan0", + TestChipV5.CHIP_MODE_ID); + } + /** + * Validate creation of AP Bridge interface from blank start-up in chip V1.5 + */ + @Test + public void testCreateApBridgeInterfaceNoInitModeTestChipV15() throws Exception { + mWifiChipV15 = mock(android.hardware.wifi.V1_5.IWifiChip.class); + runCreateSingleXxxInterfaceNoInitMode(new TestChipV5(), HDM_CREATE_IFACE_AP_BRIDGE, "wlan0", + TestChipV5.CHIP_MODE_ID); + } + + + /////////////////////////////////////////////////////////////////////////////////////// // utilities /////////////////////////////////////////////////////////////////////////////////////// @@ -2449,8 +2477,13 @@ public class HalDeviceManagerTest extends WifiBaseTest { private void runCreateSingleXxxInterfaceNoInitMode(ChipMockBase chipMock, int ifaceTypeToCreate, String ifaceName, int finalChipMode) throws Exception { chipMock.initialize(); - mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, - mManagerStatusListenerMock); + if (mWifiChipV15 != null) { + mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, + mWifiChipV15, mManagerStatusListenerMock); + } else { + mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, + mManagerStatusListenerMock); + } executeAndValidateInitializationSequence(); executeAndValidateStartupSequence(); @@ -2478,6 +2511,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { case HDM_CREATE_IFACE_STA: mInOrder.verify(chipMock.chip).removeStaIface(ifaceName); break; + case HDM_CREATE_IFACE_AP_BRIDGE: case HDM_CREATE_IFACE_AP: mInOrder.verify(chipMock.chip).removeApIface(ifaceName); break; @@ -2619,17 +2653,27 @@ public class HalDeviceManagerTest extends WifiBaseTest { mDut.createStaIface(requiredChipCapabilities, destroyedListener, mHandler, requestorWs); break; + case HDM_CREATE_IFACE_AP_BRIDGE: case HDM_CREATE_IFACE_AP: iface = mock(IWifiApIface.class); doAnswer(new GetNameAnswer(ifaceName)).when(iface).getName( any(IWifiIface.getNameCallback.class)); doAnswer(new GetTypeAnswer(IfaceType.AP)).when(iface).getType( any(IWifiIface.getTypeCallback.class)); - doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, iface)).when( - chipMock.chip).createApIface(any(IWifiChip.createApIfaceCallback.class)); + if (mWifiChipV15 != null && ifaceTypeToCreate == HDM_CREATE_IFACE_AP_BRIDGE) { + doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, iface)).when( + mWifiChipV15).createBridgedApIface( + any(android.hardware.wifi.V1_5.IWifiChip + .createBridgedApIfaceCallback.class)); + } else { + doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, iface)).when( + chipMock.chip).createApIface( + any(IWifiChip.createApIfaceCallback.class)); + } mDut.createApIface(requiredChipCapabilities, - destroyedListener, mHandler, requestorWs); + destroyedListener, mHandler, requestorWs, + ifaceTypeToCreate == HDM_CREATE_IFACE_AP_BRIDGE); break; case HDM_CREATE_IFACE_P2P: iface = mock(IWifiP2pIface.class); @@ -2689,9 +2733,16 @@ public class HalDeviceManagerTest extends WifiBaseTest { mInOrder.verify(chipMock.chip).createStaIface( any(IWifiChip.createStaIfaceCallback.class)); break; + case HDM_CREATE_IFACE_AP_BRIDGE: case HDM_CREATE_IFACE_AP: - mInOrder.verify(chipMock.chip).createApIface( - any(IWifiChip.createApIfaceCallback.class)); + if (mWifiChipV15 != null && ifaceTypeToCreate == HDM_CREATE_IFACE_AP_BRIDGE) { + mInOrder.verify(mWifiChipV15) + .createBridgedApIface(any(android.hardware.wifi.V1_5.IWifiChip + .createBridgedApIfaceCallback.class)); + } else { + mInOrder.verify(chipMock.chip).createApIface( + any(IWifiChip.createApIfaceCallback.class)); + } break; case HDM_CREATE_IFACE_P2P: mInOrder.verify(chipMock.chip).createP2pIface( @@ -2964,6 +3015,11 @@ public class HalDeviceManagerTest extends WifiBaseTest { addInterfaceInfo(IfaceType.AP); } + public void answer(android.hardware.wifi.V1_5.IWifiChip.createBridgedApIfaceCallback cb) { + cb.onValues(mStatus, (IWifiApIface) mWifiIface); + addInterfaceInfo(IfaceType.AP); + } + public void answer(IWifiChip.createP2pIfaceCallback cb) { cb.onValues(mStatus, (IWifiP2pIface) mWifiIface); addInterfaceInfo(IfaceType.P2P); @@ -3400,7 +3456,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { void initialize() throws Exception { super.initialize(); - chipMockId = CHIP_MOCK_V5; chipCapabilities |= android.hardware.wifi.V1_5.IWifiChip.ChipCapabilityMask.WIGIG; diff --git a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java index a69359fde..4439a8e07 100644 --- a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java @@ -176,7 +176,8 @@ public class SoftApManagerTest extends WifiBaseTest { when(mWifiNative.setApMacAddress(any(), any())).thenReturn(true); when(mWifiNative.startSoftAp(eq(TEST_INTERFACE_NAME), any(), anyBoolean(), any(WifiNative.SoftApListener.class))).thenReturn(true); - + when(mWifiNative.setupInterfaceForSoftApMode(any(), any(), anyBoolean())) + .thenReturn(TEST_INTERFACE_NAME); when(mFrameworkFacade.getIntegerSetting( mContext, Settings.Global.SOFT_AP_TIMEOUT_ENABLED, 1)).thenReturn(1); mAlarmManager = new TestAlarmManager(); @@ -297,8 +298,6 @@ public class SoftApManagerTest extends WifiBaseTest { /** Tests softap startup if default config fails to load. **/ @Test public void startSoftApDefaultConfigFailedToLoad() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); - when(mWifiApConfigStore.getApConfiguration()).thenReturn(null); SoftApModeConfiguration nullApConfig = new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null, @@ -308,15 +307,12 @@ public class SoftApManagerTest extends WifiBaseTest { WifiManager.SAP_START_FAILURE_GENERAL); verify(mListener).onStartFailure(mSoftApManager); ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); - verify(mContext, times(2)).sendStickyBroadcastAsUser(intentCaptor.capture(), + verify(mContext).sendStickyBroadcastAsUser(intentCaptor.capture(), eq(UserHandle.ALL)); List<Intent> capturedIntents = intentCaptor.getAllValues(); - checkApStateChangedBroadcast(capturedIntents.get(0), WIFI_AP_STATE_ENABLING, - WIFI_AP_STATE_DISABLED, HOTSPOT_NO_ERROR, TEST_INTERFACE_NAME, - nullApConfig.getTargetMode()); - checkApStateChangedBroadcast(capturedIntents.get(1), WIFI_AP_STATE_FAILED, - WIFI_AP_STATE_ENABLING, WifiManager.SAP_START_FAILURE_GENERAL, TEST_INTERFACE_NAME, + checkApStateChangedBroadcast(capturedIntents.get(0), WIFI_AP_STATE_FAILED, + WIFI_AP_STATE_DISABLED, WifiManager.SAP_START_FAILURE_GENERAL, null, nullApConfig.getTargetMode()); } @@ -327,7 +323,7 @@ public class SoftApManagerTest extends WifiBaseTest { @Test public void testSetupForSoftApModeNullApInterfaceNameFailureIncrementsMetrics() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(null); + when(mWifiNative.setupInterfaceForSoftApMode(any(), any(), anyBoolean())).thenReturn(null); when(mWifiApConfigStore.getApConfiguration()).thenReturn(null); SoftApModeConfiguration nullApConfig = new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null, @@ -355,8 +351,7 @@ public class SoftApManagerTest extends WifiBaseTest { @Test public void testSetupForSoftApModeEmptyInterfaceNameFailureIncrementsMetrics() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(""); - when(mWifiApConfigStore.getApConfiguration()).thenReturn(null); + when(mWifiNative.setupInterfaceForSoftApMode(any(), any(), anyBoolean())).thenReturn(""); SoftApModeConfiguration nullApConfig = new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED, null, mTestSoftApCapability); @@ -389,8 +384,6 @@ public class SoftApManagerTest extends WifiBaseTest { WifiManager.IFACE_IP_MODE_TETHERED, configBuilder.build(), mTestSoftApCapability); - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); - mSoftApManager = createSoftApManager(softApConfig, null, ROLE_SOFTAP_TETHERED); verify(mWifiNative, never()).setCountryCodeHal(eq(TEST_INTERFACE_NAME), any()); @@ -421,7 +414,6 @@ public class SoftApManagerTest extends WifiBaseTest { WifiManager.IFACE_IP_MODE_TETHERED, configBuilder.build(), mTestSoftApCapability); - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); when(mWifiNative.setCountryCodeHal( TEST_INTERFACE_NAME, TEST_COUNTRY_CODE.toUpperCase(Locale.ROOT))) .thenReturn(false); @@ -535,7 +527,6 @@ public class SoftApManagerTest extends WifiBaseTest { when(mWifiNative.getChannelsForBand(WifiScanner.WIFI_BAND_5_GHZ)) .thenReturn(EMPTY_CHANNEL_ARRAY); - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); when(mWifiNative.isHalStarted()).thenReturn(true); mSoftApManager = createSoftApManager(softApConfig, TEST_COUNTRY_CODE, ROLE_SOFTAP_TETHERED); @@ -558,7 +549,6 @@ public class SoftApManagerTest extends WifiBaseTest { */ @Test public void startSoftApApInterfaceFailedToStart() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); when(mWifiNative.startSoftAp(eq(TEST_INTERFACE_NAME), any(), anyBoolean(), any(WifiNative.SoftApListener.class))).thenReturn(false); @@ -1573,7 +1563,6 @@ public class SoftApManagerTest extends WifiBaseTest { @Test public void setsCustomMacWhenSetMacNotSupport() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); when(mWifiNative.isApSetMacAddressSupported(any())).thenReturn(false); Builder configBuilder = new SoftApConfiguration.Builder(); configBuilder.setBand(SoftApConfiguration.BAND_2GHZ); @@ -1593,7 +1582,6 @@ public class SoftApManagerTest extends WifiBaseTest { @Test public void setMacFailureWhenCustomMac() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); Builder configBuilder = new SoftApConfiguration.Builder(); configBuilder.setBand(SoftApConfiguration.BAND_2GHZ); configBuilder.setSsid(TEST_SSID); @@ -1613,7 +1601,6 @@ public class SoftApManagerTest extends WifiBaseTest { @Test public void setMacFailureWhenRandomMac() throws Exception { - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); SoftApConfiguration randomizedBssidConfig = new SoftApConfiguration.Builder(mDefaultApConfig) .setBssid(TEST_MAC_ADDRESS).build(); @@ -1791,8 +1778,6 @@ public class SoftApManagerTest extends WifiBaseTest { .setChannel(DEFAULT_AP_CHANNEL, SoftApConfiguration.BAND_2GHZ) .build(); } - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())) - .thenReturn(TEST_INTERFACE_NAME); mSoftApManager = createSoftApManager(softApConfig, countryCode, softApConfig.getTargetMode() == IFACE_IP_MODE_LOCAL_ONLY ? ROLE_SOFTAP_LOCAL_ONLY : ROLE_SOFTAP_TETHERED); @@ -1801,7 +1786,7 @@ public class SoftApManagerTest extends WifiBaseTest { ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(mFakeSoftApNotifier).dismissSoftApShutDownTimeoutExpiredNotification(); order.verify(mWifiNative).setupInterfaceForSoftApMode( - mWifiNativeInterfaceCallbackCaptor.capture(), eq(TEST_WORKSOURCE)); + mWifiNativeInterfaceCallbackCaptor.capture(), eq(TEST_WORKSOURCE), eq(false)); ArgumentCaptor<SoftApConfiguration> configCaptor = ArgumentCaptor.forClass(SoftApConfiguration.class); order.verify(mCallback).onStateChanged(WifiManager.WIFI_AP_STATE_ENABLING, 0); @@ -1889,7 +1874,6 @@ public class SoftApManagerTest extends WifiBaseTest { public void testSoftApEnableFailureBecauseSetMaxClientWhenNotSupport() throws Exception { long testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_WPA3_SAE | SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD; - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); SoftApCapability noClientControlCapability = new SoftApCapability(testSoftApFeature); noClientControlCapability.setMaxSupportedClients(1); SoftApConfiguration softApConfig = new SoftApConfiguration.Builder( @@ -1913,7 +1897,6 @@ public class SoftApManagerTest extends WifiBaseTest { throws Exception { long testSoftApFeature = SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT | SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD; - when(mWifiNative.setupInterfaceForSoftApMode(any(), any())).thenReturn(TEST_INTERFACE_NAME); SoftApCapability noSaeCapability = new SoftApCapability(testSoftApFeature); SoftApConfiguration softApConfig = new SoftApConfiguration.Builder( mDefaultApConfig).setPassphrase(TEST_PASSWORD, @@ -2239,4 +2222,23 @@ public class SoftApManagerTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mWifiNative, never()).forceClientDisconnect(any(), any(), anyInt()); } + + /** + * Test that dual interfaces will be setup when dual band config. + */ + @Test + public void testSetupDualBandForSoftApModeApInterfaceName() + throws Exception { + int[] dual_bands = new int[] { + SoftApConfiguration.BAND_2GHZ, SoftApConfiguration.BAND_5GHZ}; + Builder configBuilder = new SoftApConfiguration.Builder(); + configBuilder.setBands(dual_bands); + configBuilder.setSsid(TEST_SSID); + SoftApModeConfiguration dualBandConfig = new SoftApModeConfiguration( + WifiManager.IFACE_IP_MODE_TETHERED, configBuilder.build(), + mTestSoftApCapability); + mSoftApManager = createSoftApManager(dualBandConfig, + TEST_COUNTRY_CODE, ROLE_SOFTAP_TETHERED); + verify(mWifiNative).setupInterfaceForSoftApMode(any(), any(), eq(true)); + } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java index bf8e26b88..4a8951bf8 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java @@ -125,7 +125,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { when(mWifiVendorHal.isVendorHalReady()).thenReturn(true); when(mWifiVendorHal.startVendorHal()).thenReturn(true); when(mWifiVendorHal.createStaIface(any(), any())).thenReturn(IFACE_NAME_0); - when(mWifiVendorHal.createApIface(any(), any())).thenReturn(IFACE_NAME_0); + when(mWifiVendorHal.createApIface(any(), any(), anyBoolean())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.removeStaIface(any())).thenReturn(true); when(mWifiVendorHal.removeApIface(any())).thenReturn(true); when(mWifiVendorHal.replaceStaIfaceRequestorWs(any(), any())).thenReturn(true); @@ -424,18 +424,17 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { executeAndValidateSetupClientInterface( false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0, mNetworkObserverCaptor0); - // Trigger the STA interface teardown when AP interface is created. // The iface name will remain the same. doAnswer(new MockAnswerUtil.AnswerWithArguments() { - public String answer(InterfaceDestroyedListener destroyedListener, WorkSource ws) { + public String answer(InterfaceDestroyedListener destroyedListener, WorkSource ws, + boolean isBridged) { mIfaceDestroyedListenerCaptor0.getValue().onDestroyed(IFACE_NAME_0); return IFACE_NAME_0; } - }).when(mWifiVendorHal).createApIface(any(), any()); - + }).when(mWifiVendorHal).createApIface(any(), any(), eq(false)); assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForSoftApMode( - mIfaceCallback1, TEST_WORKSOURCE)); + mIfaceCallback1, TEST_WORKSOURCE, false)); mInOrder.verify(mHostapdHal).isInitializationStarted(); mInOrder.verify(mHostapdHal).initialize(); @@ -444,7 +443,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mHostapdHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).createApIface( - mIfaceDestroyedListenerCaptor1.capture(), eq(TEST_WORKSOURCE)); + mIfaceDestroyedListenerCaptor1.capture(), eq(TEST_WORKSOURCE), eq(false)); // Creation of AP interface should trigger the STA interface destroy validateOnDestroyedClientInterface( false, true, IFACE_NAME_0, mIfaceCallback0, mNetworkObserverCaptor0.getValue()); @@ -696,14 +695,15 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { // Trigger the STA interface teardown when AP interface is created. // The iface name will remain the same. doAnswer(new MockAnswerUtil.AnswerWithArguments() { - public String answer(InterfaceDestroyedListener destroyedListener, WorkSource ws) { + public String answer(InterfaceDestroyedListener destroyedListener, WorkSource ws, + boolean isBriger) { mIfaceDestroyedListenerCaptor0.getValue().onDestroyed(IFACE_NAME_0); return IFACE_NAME_0; } - }).when(mWifiVendorHal).createApIface(any(), any()); + }).when(mWifiVendorHal).createApIface(any(), any(), eq(false)); assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForSoftApMode( - mIfaceCallback1, TEST_WORKSOURCE)); + mIfaceCallback1, TEST_WORKSOURCE, false)); mInOrder.verify(mHostapdHal).isInitializationStarted(); mInOrder.verify(mHostapdHal).initialize(); @@ -712,7 +712,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mHostapdHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).createApIface( - mIfaceDestroyedListenerCaptor1.capture(), eq(TEST_WORKSOURCE)); + mIfaceDestroyedListenerCaptor1.capture(), eq(TEST_WORKSOURCE), eq(false)); // Creation of AP interface should trigger the STA interface destroy validateOnDestroyedClientInterface( false, true, IFACE_NAME_0, mIfaceCallback0, mNetworkObserverCaptor0.getValue()); @@ -765,12 +765,14 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mNetworkObserverCaptor0); // Trigger vendor HAL death + mWifiVendorHalDeathHandlerCaptor.getValue().onDeath(); mInOrder.verify(mWifiMetrics).incrementNumHalCrashes(); verify(mStatusListener).onStatusChanged(false); verify(mStatusListener).onStatusChanged(true); + } /** @@ -989,7 +991,8 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { @Test public void testSetupSoftApInterfaceFailureInStartHal() throws Exception { when(mWifiVendorHal.startVendorHal()).thenReturn(false); - assertNull(mWifiNative.setupInterfaceForSoftApMode(mIfaceCallback0, TEST_WORKSOURCE)); + assertNull(mWifiNative.setupInterfaceForSoftApMode(mIfaceCallback0, TEST_WORKSOURCE, + false)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -1007,7 +1010,8 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { @Test public void testSetupSoftApInterfaceFailureInStartHostapd() throws Exception { when(mHostapdHal.startDaemon()).thenReturn(false); - assertNull(mWifiNative.setupInterfaceForSoftApMode(mIfaceCallback0, TEST_WORKSOURCE)); + assertNull(mWifiNative.setupInterfaceForSoftApMode(mIfaceCallback0, TEST_WORKSOURCE, + false)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -1027,8 +1031,9 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { */ @Test public void testSetupSoftApInterfaceFailureInHalCreateApIface() throws Exception { - when(mWifiVendorHal.createApIface(any(), any())).thenReturn(null); - assertNull(mWifiNative.setupInterfaceForSoftApMode(mIfaceCallback0, TEST_WORKSOURCE)); + when(mWifiVendorHal.createApIface(any(), any(), anyBoolean())).thenReturn(null); + assertNull(mWifiNative.setupInterfaceForSoftApMode( + mIfaceCallback0, TEST_WORKSOURCE, false)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -1038,7 +1043,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mHostapdHal).isInitializationComplete(); mInOrder.verify(mHostapdHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createApIface(any(), any()); + mInOrder.verify(mWifiVendorHal).createApIface(any(), any(), anyBoolean()); mInOrder.verify(mWifiMetrics).incrementNumSetupSoftApInterfaceFailureDueToHal(); // To test if the failure is handled cleanly, invoke teardown and ensure that @@ -1054,7 +1059,8 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { public void testSetupSoftApInterfaceFailureInWificondSetupInterfaceForSoftapMode() throws Exception { when(mWificondControl.setupInterfaceForSoftApMode(any())).thenReturn(false); - assertNull(mWifiNative.setupInterfaceForSoftApMode(mIfaceCallback0, TEST_WORKSOURCE)); + assertNull(mWifiNative.setupInterfaceForSoftApMode( + mIfaceCallback0, TEST_WORKSOURCE, false)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -1065,7 +1071,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mHostapdHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).createApIface( - mIfaceDestroyedListenerCaptor0.capture(), eq(TEST_WORKSOURCE)); + mIfaceDestroyedListenerCaptor0.capture(), eq(TEST_WORKSOURCE), eq(false)); mInOrder.verify(mWificondControl).setupInterfaceForSoftApMode(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).removeApIface(any()); @@ -1185,7 +1191,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { // Now setup an AP interface. assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForSoftApMode( - mIfaceCallback1, TEST_WORKSOURCE)); + mIfaceCallback1, TEST_WORKSOURCE, false)); mInOrder.verify(mHostapdHal).isInitializationStarted(); mInOrder.verify(mHostapdHal).initialize(); @@ -1225,7 +1231,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { // First setup an AP interface and verify. assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForSoftApMode( - mIfaceCallback0, TEST_WORKSOURCE)); + mIfaceCallback0, TEST_WORKSOURCE, false)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mHostapdHal).isInitializationStarted(); @@ -1546,9 +1552,9 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { String ifaceName, @Mock WifiNative.InterfaceCallback callback, ArgumentCaptor<InterfaceDestroyedListener> destroyedListenerCaptor, ArgumentCaptor<NetdEventObserver> networkObserverCaptor) throws Exception { - when(mWifiVendorHal.createApIface(any(), any())).thenReturn(ifaceName); + when(mWifiVendorHal.createApIface(any(), any(), eq(false))).thenReturn(ifaceName); assertEquals(ifaceName, mWifiNative.setupInterfaceForSoftApMode( - callback, TEST_WORKSOURCE)); + callback, TEST_WORKSOURCE, false)); validateSetupSoftApInterface( existingStaIface, existingApIface, ifaceName, destroyedListenerCaptor, @@ -1572,7 +1578,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { } mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).createApIface( - destroyedListenerCaptor.capture(), eq(TEST_WORKSOURCE)); + destroyedListenerCaptor.capture(), eq(TEST_WORKSOURCE), eq(false)); mInOrder.verify(mWificondControl).setupInterfaceForSoftApMode(ifaceName); mInOrder.verify(mNetdWrapper).registerObserver(networkObserverCaptor.capture()); mInOrder.verify(mNetdWrapper).isInterfaceUp(ifaceName); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index 8183acbce..01f7b37fb 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -346,7 +346,7 @@ public class WifiVendorHalTest extends WifiBaseTest { }).when(mHalDeviceManager).stop(); when(mHalDeviceManager.createStaIface(any(), eq(null), any())) .thenReturn(mIWifiStaIface); - when(mHalDeviceManager.createApIface(any(), eq(null), any())) + when(mHalDeviceManager.createApIface(any(), eq(null), any(), anyBoolean())) .thenReturn(mIWifiApIface); when(mHalDeviceManager.removeIface(any())).thenReturn(true); when(mHalDeviceManager.getChip(any(IWifiIface.class))) @@ -427,7 +427,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); verify(mIWifiChip).registerEventCallback(any(IWifiChipEventCallback.class)); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); } /** @@ -440,7 +440,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager).createApIface(any(), eq(null), any(), anyBoolean()); verify(mHalDeviceManager).getChip(eq(mIWifiApIface)); verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); @@ -467,7 +467,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).start(); verify(mHalDeviceManager, never()).createStaIface(any(), eq(null), any()); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); verify(mIWifiStaIface, never()) .registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -487,7 +487,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).createStaIface(any(), eq(null), any()); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); verify(mIWifiStaIface, never()) .registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -509,7 +509,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); } /** @@ -529,7 +529,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); } /** @@ -550,7 +550,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); verify(mIWifiChip).registerEventCallback(any(IWifiChipEventCallback.class)); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); } /** @@ -559,12 +559,13 @@ public class WifiVendorHalTest extends WifiBaseTest { */ @Test public void testStartHalFailureInApMode() throws Exception { - when(mHalDeviceManager.createApIface(any(), eq(null), any())).thenReturn(null); + when(mHalDeviceManager.createApIface(any(), eq(null), any(), anyBoolean())) + .thenReturn(null); assertFalse(mWifiVendorHal.startVendorHalAp()); assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager).createApIface(any(), eq(null), any(), anyBoolean()); verify(mHalDeviceManager).stop(); verify(mHalDeviceManager, never()).createStaIface(any(), eq(null), any()); @@ -590,7 +591,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); - verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager, never()).createApIface(any(), eq(null), any(), anyBoolean()); } /** @@ -607,7 +608,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).start(); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager).createApIface(any(), eq(null), any()); + verify(mHalDeviceManager).createApIface(any(), eq(null), any(), anyBoolean()); verify(mHalDeviceManager).getChip(eq(mIWifiApIface)); verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); @@ -657,12 +658,12 @@ public class WifiVendorHalTest extends WifiBaseTest { InterfaceDestroyedListener externalLister = mock(InterfaceDestroyedListener.class); assertTrue(mWifiVendorHal.startVendorHal()); - assertNotNull(mWifiVendorHal.createApIface(externalLister, TEST_WORKSOURCE)); + assertNotNull(mWifiVendorHal.createApIface(externalLister, TEST_WORKSOURCE, false)); assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); verify(mHalDeviceManager).createApIface( - internalListenerCaptor.capture(), eq(null), eq(TEST_WORKSOURCE)); + internalListenerCaptor.capture(), eq(null), eq(TEST_WORKSOURCE), eq(false)); verify(mHalDeviceManager).getChip(eq(mIWifiApIface)); verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); @@ -2588,8 +2589,8 @@ public class WifiVendorHalTest extends WifiBaseTest { }).when(mIWifiApIface).getName(any(IWifiIface.getNameCallback.class)); assertTrue(mWifiVendorHal.startVendorHal()); - assertNull(mWifiVendorHal.createApIface(null, TEST_WORKSOURCE)); - verify(mHalDeviceManager).createApIface(any(), eq(null), eq(TEST_WORKSOURCE)); + assertNull(mWifiVendorHal.createApIface(null, TEST_WORKSOURCE, false)); + verify(mHalDeviceManager).createApIface(any(), eq(null), eq(TEST_WORKSOURCE), eq(false)); } /** @@ -2611,8 +2612,8 @@ public class WifiVendorHalTest extends WifiBaseTest { @Test public void testCreateRemoveApIface() throws RemoteException { assertTrue(mWifiVendorHal.startVendorHal()); - String ifaceName = mWifiVendorHal.createApIface(null, TEST_WORKSOURCE); - verify(mHalDeviceManager).createApIface(any(), eq(null), eq(TEST_WORKSOURCE)); + String ifaceName = mWifiVendorHal.createApIface(null, TEST_WORKSOURCE, false); + verify(mHalDeviceManager).createApIface(any(), eq(null), eq(TEST_WORKSOURCE), eq(false)); assertEquals(TEST_IFACE_NAME, ifaceName); assertTrue(mWifiVendorHal.removeApIface(ifaceName)); verify(mHalDeviceManager).removeIface(eq(mIWifiApIface)); |