From b6fe161f585a030a3397fe32abb07c4cddf787f4 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 18 Mar 2020 14:00:48 -0700 Subject: [PATCH] Adding additional logs to debug synchronous modification of update listeners Bug: 151665474 Change-Id: I6f2d900852bd8dc76249781ab15cb6c269dd7a7a --- src/com/android/launcher3/allapps/AllAppsStore.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java index c4b2f68c94..a6ef10a8f9 100644 --- a/src/com/android/launcher3/allapps/AllAppsStore.java +++ b/src/com/android/launcher3/allapps/AllAppsStore.java @@ -18,6 +18,7 @@ package com.android.launcher3.allapps; import static com.android.launcher3.AppInfo.COMPONENT_KEY_COMPARATOR; import static com.android.launcher3.AppInfo.EMPTY_ARRAY; +import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -55,6 +56,8 @@ public class AllAppsStore { private int mDeferUpdatesFlags = 0; private boolean mUpdatePending = false; + private boolean mListenerUpdateInProgress = false; + public AppInfo[] getApps() { return mApps; } @@ -99,10 +102,12 @@ public class AllAppsStore { mUpdatePending = true; return; } + mListenerUpdateInProgress = true; int count = mUpdateListeners.size(); for (int i = 0; i < count; i++) { mUpdateListeners.get(i).onAppsUpdated(); } + mListenerUpdateInProgress = false; } public void addUpdateListener(OnUpdateListener listener) { @@ -110,6 +115,9 @@ public class AllAppsStore { } public void removeUpdateListener(OnUpdateListener listener) { + if (mListenerUpdateInProgress) { + Log.e("AllAppsStore", "Trying to remove listener during update", new Exception()); + } mUpdateListeners.remove(listener); }