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
This commit is contained in:
Nilesh Agrawal
2013-12-17 15:20:50 -08:00
parent f6a22ada81
commit dff0bfeb90
2 changed files with 34 additions and 13 deletions

View File

@@ -266,19 +266,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
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;
}