diff options
7 files changed, 70 insertions, 379 deletions
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java index d75f4895d..be3f6af4d 100644 --- a/service/java/com/android/server/wifi/HalDeviceManager.java +++ b/service/java/com/android/server/wifi/HalDeviceManager.java @@ -217,10 +217,6 @@ public class HalDeviceManager { * Create a STA interface if possible. Changes chip mode and removes conflicting interfaces if * needed and permitted by priority. * - * @param lowPrioritySta Indicates whether the requested STA is a low priority STA. The priority - * and preemption rules for low priority STA are: - * - Do not destroy any interface for it (even another low priority STA) - * - Destroy it for any other request * @param destroyedListener Optional (nullable) listener to call when the allocated interface * is removed. Will only be registered and used if an interface is * created successfully. @@ -229,10 +225,9 @@ public class HalDeviceManager { * iface destruction. * @return A newly created interface - or null if the interface could not be created. */ - public IWifiStaIface createStaIface(boolean lowPrioritySta, + public IWifiStaIface createStaIface( @Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler) { - return (IWifiStaIface) createIface(IfaceType.STA, lowPrioritySta, destroyedListener, - handler); + return (IWifiStaIface) createIface(IfaceType.STA, destroyedListener, handler); } /** @@ -240,7 +235,7 @@ public class HalDeviceManager { */ public IWifiApIface createApIface(@Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler) { - return (IWifiApIface) createIface(IfaceType.AP, false, destroyedListener, handler); + return (IWifiApIface) createIface(IfaceType.AP, destroyedListener, handler); } /** @@ -248,7 +243,7 @@ public class HalDeviceManager { */ public IWifiP2pIface createP2pIface(@Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler) { - return (IWifiP2pIface) createIface(IfaceType.P2P, false, destroyedListener, handler); + return (IWifiP2pIface) createIface(IfaceType.P2P, destroyedListener, handler); } /** @@ -256,7 +251,7 @@ public class HalDeviceManager { */ public IWifiNanIface createNanIface(@Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler) { - return (IWifiNanIface) createIface(IfaceType.NAN, false, destroyedListener, handler); + return (IWifiNanIface) createIface(IfaceType.NAN, destroyedListener, handler); } /** @@ -556,15 +551,13 @@ public class HalDeviceManager { public int type; public Set<InterfaceDestroyedListenerProxy> destroyedListeners = new HashSet<>(); public long creationTime; - public boolean isLowPriority; @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{name=").append(name).append(", type=").append(type) .append(", destroyedListeners.size()=").append(destroyedListeners.size()) - .append(", creationTime=").append(creationTime).append( - ", isLowPriority=").append(isLowPriority).append("}"); + .append(", creationTime=").append(creationTime).append("}"); return sb.toString(); } } @@ -1377,10 +1370,10 @@ public class HalDeviceManager { return results; } - private IWifiIface createIface(int ifaceType, boolean lowPriority, - InterfaceDestroyedListener destroyedListener, Handler handler) { + private IWifiIface createIface(int ifaceType, InterfaceDestroyedListener destroyedListener, + Handler handler) { if (mDbg) { - Log.d(TAG, "createIface: ifaceType=" + ifaceType + ", lowPriority=" + lowPriority); + Log.d(TAG, "createIface: ifaceType=" + ifaceType); } synchronized (mLock) { @@ -1397,8 +1390,8 @@ public class HalDeviceManager { return null; } - IWifiIface iface = createIfaceIfPossible(chipInfos, ifaceType, lowPriority, - destroyedListener, handler); + IWifiIface iface = createIfaceIfPossible(chipInfos, ifaceType, destroyedListener, + handler); if (iface != null) { // means that some configuration has changed if (!dispatchAvailableForRequestListeners()) { return null; // catastrophic failure - shut down @@ -1410,10 +1403,10 @@ public class HalDeviceManager { } private IWifiIface createIfaceIfPossible(WifiChipInfo[] chipInfos, int ifaceType, - boolean lowPriority, InterfaceDestroyedListener destroyedListener, Handler handler) { + InterfaceDestroyedListener destroyedListener, Handler handler) { if (VDBG) { Log.d(TAG, "createIfaceIfPossible: chipInfos=" + Arrays.deepToString(chipInfos) - + ", ifaceType=" + ifaceType + ", lowPriority=" + lowPriority); + + ", ifaceType=" + ifaceType); } synchronized (mLock) { IfaceCreationData bestIfaceCreationProposal = null; @@ -1429,7 +1422,7 @@ public class HalDeviceManager { for (int[] expandedIfaceCombo: expandedIfaceCombos) { IfaceCreationData currentProposal = canIfaceComboSupportRequest( - chipInfo, chipMode, expandedIfaceCombo, ifaceType, lowPriority); + chipInfo, chipMode, expandedIfaceCombo, ifaceType); if (compareIfaceCreationData(currentProposal, bestIfaceCreationProposal)) { if (VDBG) Log.d(TAG, "new proposal accepted"); @@ -1455,7 +1448,6 @@ public class HalDeviceManager { cacheEntry.name, destroyedListener, handler)); } cacheEntry.creationTime = mClock.getUptimeSinceBootMillis(); - cacheEntry.isLowPriority = lowPriority; if (mDbg) Log.d(TAG, "createIfaceIfPossible: added cacheEntry=" + cacheEntry); mInterfaceInfoCache.put( @@ -1488,7 +1480,7 @@ public class HalDeviceManager { for (int[] expandedIfaceCombo: expandedIfaceCombos) { if (canIfaceComboSupportRequest(chipInfo, chipMode, expandedIfaceCombo, - ifaceType, false) != null) { + ifaceType) != null) { return true; } } @@ -1557,15 +1549,12 @@ public class HalDeviceManager { * * Response determined based on: * - Mode configuration: i.e. could the mode support the interface type in principle - * - Priority information: i.e. are we 'allowed' to remove interfaces in order to create the - * requested interface */ private IfaceCreationData canIfaceComboSupportRequest(WifiChipInfo chipInfo, - IWifiChip.ChipMode chipMode, int[] chipIfaceCombo, int ifaceType, boolean lowPriority) { + IWifiChip.ChipMode chipMode, int[] chipIfaceCombo, int ifaceType) { if (VDBG) { Log.d(TAG, "canIfaceComboSupportRequest: chipInfo=" + chipInfo + ", chipMode=" - + chipMode + ", chipIfaceCombo=" + chipIfaceCombo + ", ifaceType=" + ifaceType - + ", lowPriority=" + lowPriority); + + chipMode + ", chipIfaceCombo=" + chipIfaceCombo + ", ifaceType=" + ifaceType); } // short-circuit: does the chipIfaceCombo even support the requested type? @@ -1582,13 +1571,6 @@ public class HalDeviceManager { if (isChipModeChangeProposed) { for (int type: IFACE_TYPES_BY_PRIORITY) { if (chipInfo.ifaces[type].length != 0) { - if (lowPriority) { - if (VDBG) { - Log.d(TAG, "Couldn't delete existing type " + type - + " interfaces for a low priority request"); - } - return null; - } if (!allowedToDeleteIfaceTypeForRequestedType(type, ifaceType, chipInfo.ifaces, chipInfo.ifaces[type].length)) { if (VDBG) { @@ -1620,14 +1602,6 @@ public class HalDeviceManager { } if (tooManyInterfaces > 0) { // may need to delete some - if (lowPriority) { - if (VDBG) { - Log.d(TAG, "Couldn't delete existing type " + type - + " interfaces for a low priority request"); - } - return null; - } - if (!allowedToDeleteIfaceTypeForRequestedType(type, ifaceType, chipInfo.ifaces, tooManyInterfaces)) { if (VDBG) { @@ -1724,19 +1698,6 @@ public class HalDeviceManager { */ private boolean allowedToDeleteIfaceTypeForRequestedType(int existingIfaceType, int requestedIfaceType, WifiIfaceInfo[][] currentIfaces, int numNecessaryInterfaces) { - // rule 0: check for any low priority interfaces - int numAvailableLowPriorityInterfaces = 0; - synchronized (mLock) { - for (InterfaceCacheEntry entry : mInterfaceInfoCache.values()) { - if (entry.type == existingIfaceType && entry.isLowPriority) { - numAvailableLowPriorityInterfaces++; - } - } - } - if (numAvailableLowPriorityInterfaces >= numNecessaryInterfaces) { - return true; - } - // rule 1 if (existingIfaceType == requestedIfaceType) { return false; @@ -1782,7 +1743,6 @@ public class HalDeviceManager { } boolean lookupError = false; - LongSparseArray<WifiIfaceInfo> orderedListLowPriority = new LongSparseArray<>(); LongSparseArray<WifiIfaceInfo> orderedList = new LongSparseArray<>(); for (WifiIfaceInfo info : interfaces) { InterfaceCacheEntry cacheEntry; @@ -1795,11 +1755,7 @@ public class HalDeviceManager { lookupError = true; break; } - if (cacheEntry.isLowPriority) { - orderedListLowPriority.append(cacheEntry.creationTime, info); - } else { - orderedList.append(cacheEntry.creationTime, info); - } + orderedList.append(cacheEntry.creationTime, info); } if (lookupError) { @@ -1808,13 +1764,7 @@ public class HalDeviceManager { } else { List<WifiIfaceInfo> result = new ArrayList<>(excessInterfaces); for (int i = 0; i < excessInterfaces; ++i) { - int lowPriorityNextIndex = orderedListLowPriority.size() - i - 1; - if (lowPriorityNextIndex >= 0) { - result.add(orderedListLowPriority.valueAt(lowPriorityNextIndex)); - } else { - result.add(orderedList.valueAt( - orderedList.size() - i + orderedListLowPriority.size() - 1)); - } + result.add(orderedList.valueAt(orderedList.size() - i - 1)); } return result; } diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index e0c7fbc5e..e0e185b71 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -813,10 +813,10 @@ public class WifiNative { * For devices which do not the support the HAL, this will bypass HalDeviceManager & * teardown any existing iface. */ - private String createStaIface(@NonNull Iface iface, boolean lowPrioritySta) { + private String createStaIface(@NonNull Iface iface) { synchronized (mLock) { if (mWifiVendorHal.isVendorHalSupported()) { - return mWifiVendorHal.createStaIface(lowPrioritySta, + return mWifiVendorHal.createStaIface( new InterfaceDestoyedListenerInternal(iface.id)); } else { Log.i(TAG, "Vendor Hal not supported, ignoring createStaIface."); @@ -1039,7 +1039,7 @@ public class WifiNative { return null; } iface.externalListener = interfaceCallback; - iface.name = createStaIface(iface, /* lowPrioritySta */ false); + iface.name = createStaIface(iface); if (TextUtils.isEmpty(iface.name)) { Log.e(TAG, "Failed to create STA iface in vendor HAL"); mIfaceMgr.removeIface(iface.id); @@ -1101,7 +1101,7 @@ public class WifiNative { return null; } iface.externalListener = interfaceCallback; - iface.name = createStaIface(iface, /* lowPrioritySta */ false); + iface.name = createStaIface(iface); if (TextUtils.isEmpty(iface.name)) { Log.e(TAG, "Failed to create 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 07e55cd50..cc9b9ac8e 100644 --- a/service/java/com/android/server/wifi/WifiVendorHal.java +++ b/service/java/com/android/server/wifi/WifiVendorHal.java @@ -343,7 +343,7 @@ public class WifiVendorHal { if (!startVendorHal()) { return false; } - if (TextUtils.isEmpty(createStaIface(false, null))) { + if (TextUtils.isEmpty(createStaIface(null))) { stopVendorHal(); return false; } @@ -433,15 +433,12 @@ public class WifiVendorHal { /** * Create a STA iface using {@link HalDeviceManager}. * - * @param lowPrioritySta The requested STA has a low request priority (lower probability of - * getting created, higher probability of getting destroyed). * @param destroyedListener Listener to be invoked when the interface is destroyed. * @return iface name on success, null otherwise. */ - public String createStaIface(boolean lowPrioritySta, - InterfaceDestroyedListener destroyedListener) { + public String createStaIface(InterfaceDestroyedListener destroyedListener) { synchronized (sLock) { - IWifiStaIface iface = mHalDeviceManager.createStaIface(lowPrioritySta, + IWifiStaIface iface = mHalDeviceManager.createStaIface( new StaInterfaceDestroyedListenerInternal(destroyedListener), null); if (iface == null) { mLog.err("Failed to create STA iface").flush(); diff --git a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java index 2e6886493..36bf52b6b 100644 --- a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java @@ -328,7 +328,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener staAvailListener // availableListener @@ -342,7 +341,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -403,7 +401,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -554,7 +551,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV1.STA_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -601,7 +597,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV1.STA_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -627,7 +622,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, "wlan0", TestChipV1.AP_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -644,7 +638,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV1.STA_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -682,7 +675,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV2.CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -702,7 +694,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, "wlan0", TestChipV2.CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -907,7 +898,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate name, // ifaceName TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList idl, // destroyedListener iafrl // availableListener @@ -968,7 +958,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { any(IWifiIface.getTypeCallback.class)); doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, staIface)).when( chipMock.chip).createStaIface(any(IWifiChip.createStaIfaceCallback.class)); - assertEquals(staIface, mDut.createStaIface(false, staIdl, null)); + assertEquals(staIface, mDut.createStaIface(staIdl, null)); mInOrder.verify(chipMock.chip).configureChip(TestChipV1.STA_CHIP_MODE_ID); mInOrder.verify(staIafrl).onAvailabilityChanged(false); @@ -1025,7 +1015,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate name, // ifaceName TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList idl, // destroyedListener iafrl // availableListener @@ -1123,7 +1112,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener @@ -1133,7 +1121,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // register additional InterfaceDestroyedListeners - including a duplicate (verify that @@ -1148,7 +1136,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener @@ -1165,7 +1152,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) new IWifiIface[]{staIface, p2pIface}, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener @@ -1197,7 +1183,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null, // availableListener @@ -1222,7 +1207,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener2, // destroyedListener null // availableListener @@ -1253,7 +1237,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -1312,7 +1295,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener1, // destroyedListener staAvailListener1 // availableListener @@ -1322,7 +1304,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { verify(staAvailListener1).onAvailabilityChanged(false); // get STA interface again - IWifiIface staIface2 = mDut.createStaIface(false, staDestroyedListener2, mHandler); + IWifiIface staIface2 = mDut.createStaIface(staDestroyedListener2, mHandler); collector.checkThat("STA created", staIface2, IsNull.nullValue()); verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener1, @@ -1455,7 +1437,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1469,7 +1450,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1490,7 +1470,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1501,7 +1480,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1525,7 +1504,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener2, // destroyedListener null // availableListener (already registered) @@ -1535,7 +1513,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA3: should fail - IWifiIface staIface3 = mDut.createStaIface(false, null, null); + IWifiIface staIface3 = mDut.createStaIface(null, null); collector.checkThat("STA3 should not be created", staIface3, IsNull.nullValue()); // create AP - this will destroy the last STA created, i.e. STA2 @@ -1545,7 +1523,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener (already registered), @@ -1573,7 +1550,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1732,7 +1708,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1746,7 +1721,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1768,7 +1742,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener (already registered) @@ -1780,7 +1753,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(apAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1810,7 +1783,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener2, // destroyedListener null // availableListener (already registered) @@ -1820,7 +1792,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA3: should fail - IWifiIface staIface3 = mDut.createStaIface(false, null, null); + IWifiIface staIface3 = mDut.createStaIface(null, null); collector.checkThat("STA3 should not be created", staIface3, IsNull.nullValue()); // create NAN: should destroy the last created STA (STA2) @@ -1830,7 +1802,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener null, // availableListener (already registered) @@ -1844,7 +1815,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { verify(staDestroyedListener2).onDestroyed(getName(staIface2)); // request STA2: should fail - staIface2 = mDut.createStaIface(false, null, null); + staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, @@ -1996,7 +1967,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -2011,7 +1981,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -2032,7 +2001,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener (already registered) @@ -2044,7 +2012,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(apAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -2066,7 +2034,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { verify(apDestroyedListener).onDestroyed(getName(apIface)); // request STA2: should fail - staIface2 = mDut.createStaIface(false, null, null); + staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // create NAN @@ -2076,7 +2044,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -2086,7 +2053,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(nanAvailListener).onAvailabilityChanged(false); // request STA2: should fail - staIface2 = mDut.createStaIface(false, null, null); + staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // tear down STA @@ -2171,222 +2138,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { assertEquals(correctResults, results); } - /////////////////////////////////////////////////////////////////////////////////////// - // Tests targeting low priority STA creation - /////////////////////////////////////////////////////////////////////////////////////// - - /** - * Validate low priority STA management on Test Chip V1 (which has single STA capability). - * Procedure: - * - Create STA - * - Create STA(low priority): expect failure - * - Create AP: expect STA to be deleted - * - Create STA(low priority): expect failure - * - Delete AP - * - Create STA(low priority): success! - * - Create STA: expect STA(low priority) to be deleted - */ - @Test - public void testLowPriorityStaTestChipV1() throws Exception { - TestChipV1 chipMock = new TestChipV1(); - chipMock.initialize(); - mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, - mManagerStatusListenerMock); - executeAndValidateInitializationSequence(); - executeAndValidateStartupSequence(); - - InterfaceDestroyedListener staDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener staLpDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener apDestroyedListener = mock( - InterfaceDestroyedListener.class); - - // create STA - IWifiIface staIface = validateInterfaceSequence(chipMock, - false, // chipModeValid - -1000, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA interface wasn't created", staIface, IsNull.notNullValue()); - - // request STA(low priority): should fail - IWifiIface staLowIface = mDut.createStaIface(true, null, null); - collector.checkThat("STA(low priority) should not be created", staLowIface, - IsNull.nullValue()); - - // create AP: will destroy STA - IWifiIface apIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV1.STA_CHIP_MODE_ID, // chipModeId - IfaceType.AP, // ifaceTypeToCreate - "ap0", // ifaceName - TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) - null, // tearDownList - apDestroyedListener, // destroyedListener - null, // availableListener (already registered) - new InterfaceDestroyedListenerWithIfaceName("wlan0", staDestroyedListener) - ); - collector.checkThat("AP interface wasn't created", apIface, IsNull.notNullValue()); - - // request STA(low priority): should fail - staLowIface = mDut.createStaIface(true, null, null); - collector.checkThat("STA(low priority) should not be created", staLowIface, - IsNull.nullValue()); - - // tear down AP - mDut.removeIface(apIface); - mTestLooper.dispatchAll(); - verify(chipMock.chip).removeApIface("ap0"); - verify(apDestroyedListener).onDestroyed(getName(apIface)); - - // create STA(low priority) - staLowIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV1.AP_CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan1", // ifaceName - TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - true, // low priority - null, // tearDownList - staLpDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA(low priority) interface wasn't created", staIface, - IsNull.notNullValue()); - - // create STA: should destroy the low priority STA - staIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV1.STA_CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null, // availableListener (already registered) - new InterfaceDestroyedListenerWithIfaceName("wlan1", staLpDestroyedListener) - ); - collector.checkThat("STA interface wasn't created", staIface, - IsNull.notNullValue()); - - verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, - apDestroyedListener, staLpDestroyedListener); - } - - /** - * Validate low priority STA management on Test Chip V4 (which has single STA+AP capability). - * Procedure: - * - Create STA - * - Create STA(low priority): expect failure - * - Create AP - * - Create STA: expect failure - * - Destroy STA - * - Create STA(low priority): success! - * - Create STA: expect STA(low priority) to be deleted - */ - @Test - public void testLowPriorityStaTestChipV4() throws Exception { - TestChipV4 chipMock = new TestChipV4(); - chipMock.initialize(); - mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, - mManagerStatusListenerMock); - executeAndValidateInitializationSequence(); - executeAndValidateStartupSequence(); - - InterfaceDestroyedListener staDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener staLpDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener apDestroyedListener = mock( - InterfaceDestroyedListener.class); - - // create STA - IWifiIface staIface = validateInterfaceSequence(chipMock, - false, // chipModeValid - -1000, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA interface wasn't created", staIface, IsNull.notNullValue()); - - // request STA(low priority): should fail - IWifiIface staLowIface = mDut.createStaIface(true, null, null); - collector.checkThat("STA(low priority) should not be created", staLowIface, - IsNull.nullValue()); - - // create AP - IWifiIface apIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV4.CHIP_MODE_ID, // chipModeId - IfaceType.AP, // ifaceTypeToCreate - "ap0", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) - null, // tearDownList - apDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("AP interface wasn't created", apIface, IsNull.notNullValue()); - - // request STA2: should fail - IWifiIface sta2Iface = mDut.createStaIface(true, null, null); - collector.checkThat("STA2 should not be created", sta2Iface, - IsNull.nullValue()); - - // tear down STA - mDut.removeIface(staIface); - mTestLooper.dispatchAll(); - verify(chipMock.chip).removeStaIface("wlan0"); - verify(staDestroyedListener).onDestroyed(getName(staIface)); - - // create STA(low priority) - staLowIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV4.CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan1", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - true, // low priority - null, // tearDownList - staLpDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA(low priority) interface wasn't created", staIface, - IsNull.notNullValue()); - - // create STA: should destroy the low priority STA - staIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV4.CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null, // availableListener (already registered) - new InterfaceDestroyedListenerWithIfaceName("wlan1", staLpDestroyedListener) - ); - collector.checkThat("STA interface wasn't created", staIface, - IsNull.notNullValue()); - - verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, - apDestroyedListener, staLpDestroyedListener); - } /////////////////////////////////////////////////////////////////////////////////////// // utilities @@ -2472,7 +2223,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { ifaceTypeToCreate, ifaceName, finalChipMode, - false, // high priority null, // tearDownList idl, // destroyedListener iafrl // availableListener @@ -2553,7 +2303,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener staAvailListener // availableListener @@ -2568,7 +2317,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -2585,7 +2333,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority (but irrelevant) new IWifiIface[]{nanIface}, // tearDownList p2pDestroyedListener, // destroyedListener null, // availableListener @@ -2619,7 +2366,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -2635,7 +2381,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { private IWifiIface validateInterfaceSequence(ChipMockBase chipMock, boolean chipModeValid, int chipModeId, - int ifaceTypeToCreate, String ifaceName, int finalChipMode, boolean lowPriority, + int ifaceTypeToCreate, String ifaceName, int finalChipMode, IWifiIface[] tearDownList, InterfaceDestroyedListener destroyedListener, HalDeviceManager.InterfaceAvailableForRequestListener availableListener, @@ -2659,7 +2405,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, iface)).when( chipMock.chip).createStaIface(any(IWifiChip.createStaIfaceCallback.class)); - mDut.createStaIface(lowPriority, destroyedListener, mHandler); + mDut.createStaIface(destroyedListener, mHandler); break; case IfaceType.AP: iface = mock(IWifiApIface.class); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java index e2a233784..7d76eacee 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; @@ -120,7 +119,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mWifiVendorHalRadioModeChangeHandlerCaptor.capture()); when(mWifiVendorHal.isVendorHalSupported()).thenReturn(true); when(mWifiVendorHal.startVendorHal()).thenReturn(true); - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(IFACE_NAME_0); + when(mWifiVendorHal.createStaIface(any())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.createApIface(any())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.removeStaIface(any())).thenReturn(true); when(mWifiVendorHal.removeApIface(any())).thenReturn(true); @@ -466,12 +465,11 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { // Trigger the AP interface teardown when STA interface is created. // The iface name will remain the same. doAnswer(new MockAnswerUtil.AnswerWithArguments() { - public String answer(boolean lowPrioritySta, - InterfaceDestroyedListener destroyedListener) { + public String answer(InterfaceDestroyedListener destroyedListener) { mIfaceDestroyedListenerCaptor0.getValue().onDestroyed(IFACE_NAME_0); return IFACE_NAME_0; } - }).when(mWifiVendorHal).createStaIface(anyBoolean(), any()); + }).when(mWifiVendorHal).createStaIface(any()); assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientInConnectivityMode(mIfaceCallback1)); @@ -482,7 +480,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( mIfaceDestroyedListenerCaptor1.capture()); // Creation of STA interface should trigger the AP interface destroy. validateOnDestroyedSoftApInterface( @@ -848,7 +846,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { */ @Test public void testSetupClientInterfaceFailureInHalCreateStaIface() throws Exception { - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(null); + when(mWifiVendorHal.createStaIface(any())).thenReturn(null); assertNull(mWifiNative.setupInterfaceForClientInConnectivityMode(mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); @@ -859,7 +857,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), any()); + mInOrder.verify(mWifiVendorHal).createStaIface(any()); mInOrder.verify(mWifiMetrics).incrementNumSetupClientInterfaceFailureDueToHal(); // To test if the failure is handled cleanly, invoke teardown and ensure that @@ -886,7 +884,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any(), any(), any(), any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); @@ -920,7 +918,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any(), any(), any(), any()); mInOrder.verify(mSupplicantStaIfaceHal).setupIface(any()); @@ -1332,7 +1330,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { String ifaceName, @Mock WifiNative.InterfaceCallback callback, ArgumentCaptor<InterfaceDestroyedListener> destroyedListenerCaptor, ArgumentCaptor<NetdEventObserver> networkObserverCaptor) throws Exception { - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(ifaceName); + when(mWifiVendorHal.createStaIface(any())).thenReturn(ifaceName); assertEquals(ifaceName, mWifiNative.setupInterfaceForClientInConnectivityMode(callback)); validateSetupClientInterface( @@ -1356,7 +1354,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); } mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( destroyedListenerCaptor.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(eq(ifaceName), any(), any(), any()); @@ -1417,7 +1415,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { String ifaceName, @Mock WifiNative.InterfaceCallback callback, ArgumentCaptor<InterfaceDestroyedListener> destroyedListenerCaptor, ArgumentCaptor<NetdEventObserver> networkObserverCaptor) throws Exception { - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(ifaceName); + when(mWifiVendorHal.createStaIface(any())).thenReturn(ifaceName); assertEquals(ifaceName, mWifiNative.setupInterfaceForClientInScanMode(callback)); validateSetupClientInterfaceForScan( @@ -1434,7 +1432,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mWifiVendorHal).startVendorHal(); } mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( destroyedListenerCaptor.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(eq(ifaceName), any(), any(), any()); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java index f82c13f6e..07532fd95 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java @@ -248,7 +248,7 @@ public class WifiNativeTest extends WifiBaseTest { when(mWifiVendorHal.startVendorHal()).thenReturn(true); when(mWifiVendorHal.startVendorHalSta()).thenReturn(true); when(mWifiVendorHal.startVendorHalAp()).thenReturn(true); - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(WIFI_IFACE_NAME); + when(mWifiVendorHal.createStaIface(any())).thenReturn(WIFI_IFACE_NAME); when(mWificondControl.setupInterfaceForClientMode(any(), any(), any(), any())).thenReturn( true); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index 8778c5581..2cdcf2dda 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -380,7 +380,7 @@ public class WifiVendorHalTest extends WifiBaseTest { mLooper.dispatchAll(); } }).when(mHalDeviceManager).stop(); - when(mHalDeviceManager.createStaIface(anyBoolean(), any(), eq(null))) + when(mHalDeviceManager.createStaIface(any(), eq(null))) .thenReturn(mIWifiStaIface); when(mHalDeviceManager.createApIface(any(), eq(null))) .thenReturn(mIWifiApIface); @@ -456,7 +456,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); @@ -481,7 +481,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); } /** @@ -502,7 +502,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).start(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); verify(mHalDeviceManager, never()).createApIface(any(), eq(null)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); verify(mIWifiStaIface, never()) @@ -515,12 +515,12 @@ public class WifiVendorHalTest extends WifiBaseTest { */ @Test public void testStartHalFailureInIfaceCreationInStaMode() throws Exception { - when(mHalDeviceManager.createStaIface(anyBoolean(), any(), eq(null))).thenReturn(null); + when(mHalDeviceManager.createStaIface(any(), eq(null))).thenReturn(null); assertFalse(mWifiVendorHal.startVendorHalSta()); assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).stop(); verify(mHalDeviceManager, never()).createApIface(any(), eq(null)); @@ -540,7 +540,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(any(IWifiIface.class)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -560,7 +560,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -580,7 +580,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(any(IWifiIface.class)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -603,7 +603,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).createApIface(any(), eq(null)); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); } @@ -621,7 +621,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).start(); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); @@ -648,7 +648,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); } /** @@ -661,11 +661,11 @@ public class WifiVendorHalTest extends WifiBaseTest { InterfaceDestroyedListener externalLister = mock(InterfaceDestroyedListener.class); assertTrue(mWifiVendorHal.startVendorHal()); - assertNotNull(mWifiVendorHal.createStaIface(false, externalLister)); + assertNotNull(mWifiVendorHal.createStaIface(externalLister)); assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), internalListenerCaptor.capture(), + verify(mHalDeviceManager).createStaIface(internalListenerCaptor.capture(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).isReady(); @@ -2831,8 +2831,8 @@ public class WifiVendorHalTest extends WifiBaseTest { }).when(mIWifiStaIface).getName(any(IWifiIface.getNameCallback.class)); assertTrue(mWifiVendorHal.startVendorHal()); - assertNull(mWifiVendorHal.createStaIface(true, null)); - verify(mHalDeviceManager).createStaIface(eq(true), any(), eq(null)); + assertNull(mWifiVendorHal.createStaIface(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); } /** @@ -2858,8 +2858,8 @@ public class WifiVendorHalTest extends WifiBaseTest { @Test public void testCreateRemoveStaIface() throws RemoteException { assertTrue(mWifiVendorHal.startVendorHal()); - String ifaceName = mWifiVendorHal.createStaIface(false, null); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + String ifaceName = mWifiVendorHal.createStaIface(null); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); assertEquals(TEST_IFACE_NAME, ifaceName); assertTrue(mWifiVendorHal.removeStaIface(ifaceName)); verify(mHalDeviceManager).removeIface(eq(mIWifiStaIface)); |