diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-01-13 12:15:53 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-01-18 18:38:34 -0800 |
commit | 278359539c02ca160caf1df54ce96053a2a2ef59 (patch) | |
tree | e4dc8afc511fd553ffe8766855bb9cefdf54656e /src/com/android/launcher3/model | |
parent | 627006eeb4a9ba3bedacd7c0e4edce4fafdb9ac2 (diff) | |
download | android_packages_apps_Trebuchet-278359539c02ca160caf1df54ce96053a2a2ef59.tar.gz android_packages_apps_Trebuchet-278359539c02ca160caf1df54ce96053a2a2ef59.tar.bz2 android_packages_apps_Trebuchet-278359539c02ca160caf1df54ce96053a2a2ef59.zip |
Adding support for requesting addition of shortcut/widget
on the workspace.
Bug: 33584624
Change-Id: I664366822fe8088742faff2cce006239ab0771bc
Diffstat (limited to 'src/com/android/launcher3/model')
-rw-r--r-- | src/com/android/launcher3/model/AddWorkspaceItemsTask.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java index a03dd8f34..c97b3b5cf 100644 --- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java +++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java @@ -70,7 +70,8 @@ public class AddWorkspaceItemsTask extends ExtendedModelTask { ArrayList<Long> workspaceScreens = LauncherModel.loadWorkspaceScreensDb(context); synchronized(dataModel) { for (ItemInfo item : workspaceApps) { - if (item instanceof ShortcutInfo) { + if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION || + item.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) { // Short-circuit this logic if the icon exists somewhere on the workspace if (shortcutExists(dataModel, item.getIntent(), item.user)) { continue; @@ -143,6 +144,10 @@ public class AddWorkspaceItemsTask extends ExtendedModelTask { */ protected boolean shortcutExists(BgDataModel dataModel, Intent intent, UserHandle user) { final String intentWithPkg, intentWithoutPkg; + if (intent == null) { + // Skip items with null intents + return true; + } if (intent.getComponent() != null) { // If component is not null, an intent with null package will produce // the same result and should also be a match. |