Adding additional logs to debug synchronous modification of update listeners

Bug: 151665474
Change-Id: I6f2d900852bd8dc76249781ab15cb6c269dd7a7a
This commit is contained in:
Sunny Goyal
2020-03-18 14:00:48 -07:00
parent dfa091c0e9
commit b6fe161f58
@@ -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);
}