Prevent the creation of Shorcuts with null intents (issue 5629292)

Change-Id: I54fbad2d4af27c6d8fc0d79c33e890298a3db4dc
This commit is contained in:
Adam Cohen
2011-11-22 16:42:47 -08:00
parent d016015c23
commit d919882006
4 changed files with 22 additions and 4 deletions

View File

@@ -65,11 +65,15 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) {
LauncherApplication app = (LauncherApplication) context.getApplicationContext();
app.getModel().addShortcut(context, data,
ShortcutInfo info = app.getModel().addShortcut(context, data,
LauncherSettings.Favorites.CONTAINER_DESKTOP, screen, mCoordinates[0],
mCoordinates[1], true);
Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
Toast.LENGTH_SHORT).show();
if (info != null) {
Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
Toast.LENGTH_SHORT).show();
} else {
return false;
}
} else {
Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name),
Toast.LENGTH_SHORT).show();