Only add widgets system shortcut if widgets exist
Before we were adding it in a disabled state, and then enabling it once
widgets were bound (if widgets existed for that app). Now we load all
widgets when launcher starts so that we can use the values for the
purpose of animating the popup container. Then, as the container opens,
we reload widgets/shortcuts for that particular app and add/remove the
widgets shortcut if necessary.
Bug: 34940468
Change-Id: I64bd009442d10d3d1f9a977bdedfdb639a7dd193
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index f8c591c..3793bb5 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -732,6 +732,16 @@
if (DEBUG_LOADERS) Log.d(TAG, "step 3.2: bind deep shortcuts");
bindDeepShortcuts();
+ // Take a break
+ if (DEBUG_LOADERS) Log.d(TAG, "step 3 completed, wait for idle");
+ waitForIdle();
+ verifyNotStopped();
+
+ // fourth step
+ if (DEBUG_LOADERS) Log.d(TAG, "step 4.1: loading widgets");
+ refreshAndBindWidgetsAndShortcuts(getCallback(), false /* bindFirst */,
+ null /* packageUser */);
+
synchronized (mLock) {
// Everything loaded bind the data.
mModelLoaded = true;