From 60f54981717ff8d0a5ad02f7de487daf0b16e690 Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Thu, 23 Apr 2020 09:44:18 -0700 Subject: HDM: Resolve concurrent access issue - defer execution Bug: 154582017 Test: atest com.android.server.wifi Test: Unable to repro crash with the shell command to repro the scenario. Change-Id: Ibfa2b7a23e5eadd42fe5a455890f7446e772f5ac --- service/java/com/android/server/wifi/HalDeviceManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java index e47a33efb..783c91adf 100644 --- a/service/java/com/android/server/wifi/HalDeviceManager.java +++ b/service/java/com/android/server/wifi/HalDeviceManager.java @@ -2087,15 +2087,20 @@ public class HalDeviceManager { private void dispatchAllDestroyedListeners() { if (VDBG) Log.d(TAG, "dispatchAllDestroyedListeners"); + List triggerList = new ArrayList<>(); synchronized (mLock) { for (InterfaceCacheEntry cacheEntry: mInterfaceInfoCache.values()) { for (InterfaceDestroyedListenerProxy listener : cacheEntry.destroyedListeners) { - listener.trigger(); + triggerList.add(listener); } cacheEntry.destroyedListeners.clear(); // for insurance } mInterfaceInfoCache.clear(); } + + for (InterfaceDestroyedListenerProxy listener : triggerList) { + listener.trigger(); + } } private abstract class ListenerProxy { -- cgit v1.2.3