summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2019-11-04 14:19:17 -0800
committerJon Miranda <jonmiranda@google.com>2019-11-04 14:19:17 -0800
commitf788bbb0c43dfecdf46d0dda2f74c1131bd549ff (patch)
tree875701bb4de59ef8478a66190f0fc739cfc1858e
parentd942b4208d258d7b80c557e2f82d9be1b81c7836 (diff)
downloadandroid_packages_apps_Trebuchet-f788bbb0c43dfecdf46d0dda2f74c1131bd549ff.tar.gz
android_packages_apps_Trebuchet-f788bbb0c43dfecdf46d0dda2f74c1131bd549ff.tar.bz2
android_packages_apps_Trebuchet-f788bbb0c43dfecdf46d0dda2f74c1131bd549ff.zip
Add additional shortcutExists check to prevent same app from being auto added.
Since we made the change to treat all auto added workspace items as promise icons, the initial shortcutExists check breaks since its comparing the promise intent to the actual app intent. This additional shortcutExists check can compare the proper intents. Bug: 143803446 Change-Id: Ifa27b15205d6e17f83a4437ac175d51815688c84
-rw-r--r--src/com/android/launcher3/model/AddWorkspaceItemsTask.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index 37f28a9a2..b8c583c14 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -140,6 +140,15 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
// or app was already installed for another user.
itemInfo = new AppInfo(app.getContext(), activities.get(0), item.user)
.makeWorkspaceItem();
+
+ if (shortcutExists(dataModel, itemInfo.getIntent(), itemInfo.user)) {
+ // We need this additional check here since we treat all auto added
+ // workspace items as promise icons. At this point we now have the
+ // correct intent to compare against existing workspace icons.
+ // Icon already exists on the workspace and should not be auto-added.
+ continue;
+ }
+
WorkspaceItemInfo wii = (WorkspaceItemInfo) itemInfo;
wii.title = "";
wii.applyFrom(app.getIconCache().getDefaultIcon(item.user));