Do not allow duplicate shortcuts when ALL_APPS is disabled.
When DISABLE_ALL_APPS is true, we want to have only one shortcut for each activityexposed via the Application's manifest.
We ignore INSTALL_SHORTCUT broadcasts which have launch intents with ACTION_MAIN and CATEGORY_LAUNCHER.
Applications can still create shortcuts pointing to an already exposed component if they provide data or extras in the intent.
Change-Id: I0b05283ea6c522d197e0262c2997f7298e08740b
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index a8ac074..c76425a 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -266,19 +266,8 @@
private boolean isUninstallFromWorkspace(DragObject d) {
if (AppsCustomizePagedView.DISABLE_ALL_APPS && isWorkspaceOrFolderApplication(d)) {
ShortcutInfo shortcut = (ShortcutInfo) d.dragInfo;
- if (shortcut.intent != null && shortcut.intent.getComponent() != null) {
- Set<String> categories = shortcut.intent.getCategories();
- boolean includesLauncherCategory = false;
- if (categories != null) {
- for (String category : categories) {
- if (category.equals(Intent.CATEGORY_LAUNCHER)) {
- includesLauncherCategory = true;
- break;
- }
- }
- }
- return includesLauncherCategory;
- }
+ // Only allow manifest shortcuts to initiate an un-install.
+ return !InstallShortcutReceiver.isValidShortcutLaunchIntent(shortcut.intent);
}
return false;
}