diff options
author | Roshan Pius <rpius@google.com> | 2020-04-05 17:51:07 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2020-04-05 18:22:26 -0700 |
commit | 1220cc5c00f1992e18d63fa1feca9860fb71288d (patch) | |
tree | d8ffed9b70a9da1e53960ed9817ca575c247d38f /service | |
parent | ea3af2a48239cbd1e2b73f6ab7cf195b3b1635bb (diff) |
HalDeviceManager: Remove unused lowPriority iface flag
Bug: 153204351
Test: atest com.android.server.wifi
Change-Id: I309e8e1a025f1dacc974300b4ab6d8da9ae2e4de
Diffstat (limited to 'service')
3 files changed, 26 insertions, 79 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(); |