OSDN Git Service

Removing workspaceLoaded check from loadDeepShortcuts()
authorSunny Goyal <sunnygoyal@google.com>
Wed, 17 May 2017 19:05:46 +0000 (12:05 -0700)
committerSunny Goyal <sunnygoyal@google.com>
Wed, 17 May 2017 19:07:39 +0000 (12:07 -0700)
loadDeepShortcuts() is called after loadWorkspace() which already
clears the shortcutMap. So if loader runs twice, during the second run,
workspaceLoaded is true, but the shortcutMap had already been cleared
in loadWorkspace().

Bug: 38384071
Change-Id: I40f0faf88376617e56819aef02620488e528dfb2

src/com/android/launcher3/LauncherModel.java

index e68e637..f881b38 100644 (file)
@@ -1763,17 +1763,15 @@ public class LauncherModel extends BroadcastReceiver
         }
 
         private void loadDeepShortcuts() {
-            if (!mModelLoaded) {
-                sBgDataModel.deepShortcutMap.clear();
-                DeepShortcutManager shortcutManager = DeepShortcutManager.getInstance(mContext);
-                mHasShortcutHostPermission = shortcutManager.hasHostPermission();
-                if (mHasShortcutHostPermission) {
-                    for (UserHandle user : mUserManager.getUserProfiles()) {
-                        if (mUserManager.isUserUnlocked(user)) {
-                            List<ShortcutInfoCompat> shortcuts =
-                                    shortcutManager.queryForAllShortcuts(user);
-                            sBgDataModel.updateDeepShortcutMap(null, user, shortcuts);
-                        }
+            sBgDataModel.deepShortcutMap.clear();
+            DeepShortcutManager shortcutManager = DeepShortcutManager.getInstance(mContext);
+            mHasShortcutHostPermission = shortcutManager.hasHostPermission();
+            if (mHasShortcutHostPermission) {
+                for (UserHandle user : mUserManager.getUserProfiles()) {
+                    if (mUserManager.isUserUnlocked(user)) {
+                        List<ShortcutInfoCompat> shortcuts =
+                                shortcutManager.queryForAllShortcuts(user);
+                        sBgDataModel.updateDeepShortcutMap(null, user, shortcuts);
                     }
                 }
             }