diff options
author | Etan Cohen <etancohen@google.com> | 2019-10-04 22:53:15 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-10-04 22:53:15 +0000 |
commit | 718bf7a21502446f0b8ac133db4ad77ab60a9940 (patch) | |
tree | f5e3c9302870db1e80eedba0addaaabb4d09fa74 | |
parent | 8d9c37cebe5528310c7e9b78b373965dba8f0789 (diff) | |
parent | d1def087b15801002d0dad243841bda08886547d (diff) |
Merge "Add synchroniztaion to prevent concurrent modification exception" into qt-qpr1-dev
-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); |