From bb785c6eb38f9c4b1f71920cb6e57ca8f11d4908 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 5 May 2015 10:05:08 -0700 Subject: [PATCH] Ensuring we wait until resume before binding all apps. Bug: 20759810 --- src/com/android/launcher3/Launcher.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 4533089e9c..339b4e498d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -4165,12 +4165,29 @@ public class Launcher extends Activity mSearchDropTargetBar.setQsbSearchBar(getOrCreateQsbBar()); } + /** + * 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 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 apps) { + if (waitUntilResume(mBindAllApplicationsRunnable, true)) { + mTmpAppsList = apps; + return; + } + if (mAppsView != null) { mAppsView.setApps(apps); }