Ensuring we wait until resume before binding all apps.
Bug: 20759810
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4533089..339b4e4 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4166,11 +4166,28 @@
}
/**
+ * A runnable that we can dequeue and re-enqueue when all applications are bound (to prevent
+ * multiple calls to bind the same list.)
+ */
+ @Thunk ArrayList<AppInfo> mTmpAppsList;
+ private Runnable mBindAllApplicationsRunnable = new Runnable() {
+ public void run() {
+ bindAllApplications(mTmpAppsList);
+ mTmpAppsList = null;
+ }
+ };
+
+ /**
* Add the icons for all apps.
*
* Implementation of the method from LauncherModel.Callbacks.
*/
public void bindAllApplications(final ArrayList<AppInfo> apps) {
+ if (waitUntilResume(mBindAllApplicationsRunnable, true)) {
+ mTmpAppsList = apps;
+ return;
+ }
+
if (mAppsView != null) {
mAppsView.setApps(apps);
}