diff options
-rw-r--r-- | service/java/com/android/server/wifi/HalDeviceManager.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java index d2ad47f48..e10234f68 100644 --- a/service/java/com/android/server/wifi/HalDeviceManager.java +++ b/service/java/com/android/server/wifi/HalDeviceManager.java @@ -1723,9 +1723,11 @@ public class HalDeviceManager { int requestedIfaceType, WifiIfaceInfo[][] currentIfaces, int numNecessaryInterfaces) { // rule 0: check for any low priority interfaces int numAvailableLowPriorityInterfaces = 0; - for (InterfaceCacheEntry entry : mInterfaceInfoCache.values()) { - if (entry.type == existingIfaceType && entry.isLowPriority) { - numAvailableLowPriorityInterfaces++; + synchronized (mLock) { + for (InterfaceCacheEntry entry : mInterfaceInfoCache.values()) { + if (entry.type == existingIfaceType && entry.isLowPriority) { + numAvailableLowPriorityInterfaces++; + } } } if (numAvailableLowPriorityInterfaces >= numNecessaryInterfaces) { @@ -1780,8 +1782,10 @@ public class HalDeviceManager { LongSparseArray<WifiIfaceInfo> orderedListLowPriority = new LongSparseArray<>(); LongSparseArray<WifiIfaceInfo> orderedList = new LongSparseArray<>(); for (WifiIfaceInfo info : interfaces) { - InterfaceCacheEntry cacheEntry = mInterfaceInfoCache.get( - Pair.create(info.name, getType(info.iface))); + InterfaceCacheEntry cacheEntry; + synchronized (mLock) { + cacheEntry = mInterfaceInfoCache.get(Pair.create(info.name, getType(info.iface))); + } if (cacheEntry == null) { Log.e(TAG, "selectInterfacesToDelete: can't find cache entry with name=" + info.name); |