Don't crash when adding a shortcut.

Steps to reproduce: Menu > Add > Shortcut > Application > [any app]

E/AndroidRuntime( 1734): Caused by: java.lang.ClassCastException: com.android.launcher2.ShortcutInfo
E/AndroidRuntime( 1734):    at com.android.launcher2.Workspace.onDropExternal(Workspace.java:963)
E/AndroidRuntime( 1734):    at
com.android.launcher2.Workspace.addApplicationShortcut(Workspace.java:903)
E/AndroidRuntime( 1734):    at
com.android.launcher2.Launcher.completeAddApplication(Launcher.java:669)
E/AndroidRuntime( 1734):    at com.android.launcher2.Launcher.onActivityResult(Launcher.java:371)
E/AndroidRuntime( 1734):    at android.app.Activity.dispatchActivityResult(Activity.java:3877)
E/AndroidRuntime( 1734):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3340)
This commit is contained in:
Joe Onorato
2010-02-19 13:10:40 -08:00
parent 75dc3a9d28
commit 3c24aca5f5

View File

@@ -963,7 +963,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
if (info.container == NO_ID) {
if (info.container == NO_ID && info instanceof ApplicationInfo) {
// Came from all apps -- make a copy
info = new ShortcutInfo((ApplicationInfo)info);
}