From 6079b05445e8ce09d7d2d37efe27cf569c853fbf Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Mon, 23 May 2011 12:56:50 -0700 Subject: [PATCH 1/6] Fix crash on phones --- .../app_market_generic.png | Bin .../app_market_generic.png | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename res/{drawable-large-hdpi => drawable-hdpi}/app_market_generic.png (100%) rename res/{drawable-large-mdpi => drawable-mdpi}/app_market_generic.png (100%) diff --git a/res/drawable-large-hdpi/app_market_generic.png b/res/drawable-hdpi/app_market_generic.png similarity index 100% rename from res/drawable-large-hdpi/app_market_generic.png rename to res/drawable-hdpi/app_market_generic.png diff --git a/res/drawable-large-mdpi/app_market_generic.png b/res/drawable-mdpi/app_market_generic.png similarity index 100% rename from res/drawable-large-mdpi/app_market_generic.png rename to res/drawable-mdpi/app_market_generic.png From 092338a6324eee812ed6c65e613cb87d9745f033 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Thu, 21 Jul 2011 11:22:13 -0700 Subject: [PATCH 2/6] Fix wallpaper picker crash --- res/values/strings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index c0df443eeb..a3c263d736 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -33,6 +33,12 @@ Android Core Apps + + Select wallpaper from + + Set wallpaper + + Wallpapers Application is not installed. From 7529fa2405fb64455d35f587cd145b2590e7baf8 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 21 Jul 2011 11:46:32 -0700 Subject: [PATCH 3/6] Fixing various issues with the dock. - Prevent crash due to no overlays in certain device configurations - Fixing kb crash and adding content description for Apps button Change-Id: Ie2a2bc29e7b9408a165f93d108fdd803193afc29 --- src/com/android/launcher2/BubbleTextView.java | 12 ------------ src/com/android/launcher2/FocusHelper.java | 17 +++++++++++++++-- src/com/android/launcher2/Hotseat.java | 8 ++++++-- src/com/android/launcher2/Launcher.java | 7 +++++++ src/com/android/launcher2/Workspace.java | 2 ++ 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java index 57a6584dd4..476d06374b 100644 --- a/src/com/android/launcher2/BubbleTextView.java +++ b/src/com/android/launcher2/BubbleTextView.java @@ -330,16 +330,4 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca } return true; } - - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event) - || super.onKeyDown(keyCode, event); - } - - @Override - public boolean onKeyUp(int keyCode, KeyEvent event) { - return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event) - || super.onKeyUp(keyCode, event); - } } diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java index 233fd6fbb6..3783d566ce 100644 --- a/src/com/android/launcher2/FocusHelper.java +++ b/src/com/android/launcher2/FocusHelper.java @@ -30,10 +30,20 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +/** + * A keyboard listener we set on all the workspace icons. + */ +class BubbleTextViewKeyEventListener implements View.OnKeyListener { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + return FocusHelper.handleBubbleTextViewKeyEvent((BubbleTextView) v, keyCode, event); + } +} + /** * A keyboard listener we set on all the hotseat buttons. */ -class HotseatKeyEventListener implements View.OnKeyListener { +class HotseatBubbleTextViewKeyEventListener implements View.OnKeyListener { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { final Configuration configuration = v.getResources().getConfiguration(); @@ -612,6 +622,7 @@ public class FocusHelper { final Workspace workspace = (Workspace) layout.getParent(); final ViewGroup launcher = (ViewGroup) workspace.getParent(); final ViewGroup tabs = (ViewGroup) launcher.findViewById(R.id.qsb_bar); + final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.hotseat); int iconIndex = parent.indexOfChild(v); int iconCount = parent.getChildCount(); int pageIndex = workspace.indexOfChild(layout); @@ -678,11 +689,13 @@ public class FocusHelper { break; case KeyEvent.KEYCODE_DPAD_DOWN: if (handleKeyEvent) { - // Select the closest icon in the next line, otherwise select the tab bar + // Select the closest icon in the next line, otherwise select the button bar View newIcon = getClosestBubbleTextViewOnLine(layout, parent, v, 1); if (newIcon != null) { newIcon.requestFocus(); wasHandled = true; + } else if (hotseat != null) { + hotseat.requestFocus(); } } break; diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java index deab13177d..491691eb00 100644 --- a/src/com/android/launcher2/Hotseat.java +++ b/src/com/android/launcher2/Hotseat.java @@ -57,6 +57,7 @@ public class Hotseat extends FrameLayout { public void setup(Launcher launcher) { mLauncher = launcher; + setOnKeyListener(new HotseatBubbleTextViewKeyEventListener()); } CellLayout getLayout() { @@ -96,11 +97,14 @@ public class Hotseat extends FrameLayout { inflater.inflate(R.layout.application, mContent, false); allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null, context.getResources().getDrawable(R.drawable.apps_hotseat_button), null, null); - // button.setText(context.getString(R.string.all_apps_button_label)); + // allAppsButton.setText(context.getString(R.string.all_apps_button_label)); + allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); allAppsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(android.view.View v) { - mLauncher.showAllApps(true); + if (mLauncher != null) { + mLauncher.showAllApps(true); + } } }); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 0abdec090a..3050be4813 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2874,6 +2874,13 @@ public final class Launcher extends Activity final Workspace workspace = mWorkspace; for (int i=start; i Date: Thu, 25 Aug 2011 13:51:25 -0700 Subject: [PATCH 4/6] Tweaking the logging in the fail case, adding additional cases for where the db icon cache should be updated. (5205131) Change-Id: If5bf8d959ba9af40dbe8c13e6ed352a345e1679a --- src/com/android/launcher2/LauncherModel.java | 29 ++++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index b7f92ca47f..8f18924926 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -209,11 +209,10 @@ public class LauncherModel extends BroadcastReceiver { if (item != modelItem) { // the modelItem needs to match up perfectly with item if our model is to be // consistent with the database-- for now, just require modelItem == item - Log.e(TAG, "item: " + ((item != null) ? item.toString() : "null")); - Log.e(TAG, "modelItem: " + ((modelItem != null) ? modelItem.toString() : - "null")); - throw new RuntimeException("Error: ItemInfo passed to moveItemInDatabase " + - "doesn't match original"); + String msg = "item: " + ((item != null) ? item.toString() : "null") + + "modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + + "Error: ItemInfo passed to moveItemInDatabase doesn't match original"; + throw new RuntimeException(msg); } // Items are added/removed from the corresponding FolderInfo elsewhere, such @@ -258,11 +257,10 @@ public class LauncherModel extends BroadcastReceiver { if (item != modelItem) { // the modelItem needs to match up perfectly with item if our model is to be // consistent with the database-- for now, just require modelItem == item - Log.e(TAG, "item: " + ((item != null) ? item.toString() : "null")); - Log.e(TAG, "modelItem: " + ((modelItem != null) ? modelItem.toString() : - "null")); - throw new RuntimeException("Error: ItemInfo passed to moveItemInDatabase " + - "doesn't match original"); + String msg = "item: " + ((item != null) ? item.toString() : "null") + + "modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + + "Error: ItemInfo passed to resizeItemInDatabase doesn't match original"; + throw new RuntimeException(msg); } } }); @@ -471,11 +469,10 @@ public class LauncherModel extends BroadcastReceiver { if (item != modelItem) { // the modelItem needs to match up perfectly with item if our model is to be // consistent with the database-- for now, just require modelItem == item - Log.e(TAG, "item: " + ((item != null) ? item.toString() : "null")); - Log.e(TAG, "modelItem: " + ((modelItem != null) ? modelItem.toString() : - "null")); - throw new RuntimeException("Error: ItemInfo passed to updateItemInDatabase " + - "doesn't match original"); + String msg = "item: " + ((item != null) ? item.toString() : "null") + + "modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + + "Error: ItemInfo passed to updateItemInDatabase doesn't match original"; + throw new RuntimeException(msg); } } }); @@ -522,12 +519,14 @@ public class LauncherModel extends BroadcastReceiver { cr.delete(LauncherSettings.Favorites.getContentUri(info.id, false), null, null); sItemsIdMap.remove(info.id); sFolders.remove(info.id); + sDbIconCache.remove(info); sWorkspaceItems.remove(info); cr.delete(LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION, LauncherSettings.Favorites.CONTAINER + "=" + info.id, null); for (ItemInfo childInfo : info.contents) { sItemsIdMap.remove(childInfo.id); + sDbIconCache.remove(childInfo); } } }); From 18362aa3755c281c236f0a47341e1fb0f0ab1f52 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Mon, 29 Aug 2011 11:24:45 -0700 Subject: [PATCH 5/6] Fix crash when package list is updated bug# 5224498 Change-Id: I8953589c21e97fee3f5c3b95fb4a46beb39562b3 --- src/com/android/launcher2/LauncherModel.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 7d6206222a..4ad8922f4f 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -605,9 +605,11 @@ public class LauncherModel extends BroadcastReceiver { startLoaderFromBackground(); } else if (SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED.equals(action) || SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED.equals(action)) { - Callbacks callbacks = mCallbacks.get(); - if (callbacks != null) { - callbacks.bindSearchablesChanged(); + if (mCallbacks != null) { + Callbacks callbacks = mCallbacks.get(); + if (callbacks != null) { + callbacks.bindSearchablesChanged(); + } } } } From c1a5188be0f31d37e0ad6320aa4fa039e3211732 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Mon, 29 Aug 2011 14:02:47 -0700 Subject: [PATCH 6/6] Tagging where ItemInfos are created for debug purposes Change-Id: Iad3ed8ef4f81f4990c027ab46fd25b03b089babb --- src/com/android/launcher2/AllAppsList.java | 4 +-- .../android/launcher2/ApplicationInfo.java | 12 ++++--- .../launcher2/AppsCustomizePagedView.java | 4 +-- src/com/android/launcher2/FolderInfo.java | 3 +- .../launcher2/InstallWidgetReceiver.java | 2 +- src/com/android/launcher2/ItemInfo.java | 11 +++++-- src/com/android/launcher2/Launcher.java | 6 ++-- .../launcher2/LauncherAppWidgetInfo.java | 6 ++-- src/com/android/launcher2/LauncherModel.java | 32 +++++++++++-------- .../android/launcher2/PendingAddItemInfo.java | 8 ++++- src/com/android/launcher2/ShortcutInfo.java | 12 ++++--- src/com/android/launcher2/Workspace.java | 4 +-- 12 files changed, 65 insertions(+), 39 deletions(-) diff --git a/src/com/android/launcher2/AllAppsList.java b/src/com/android/launcher2/AllAppsList.java index 051b0bd1d7..7c107a79ad 100644 --- a/src/com/android/launcher2/AllAppsList.java +++ b/src/com/android/launcher2/AllAppsList.java @@ -91,7 +91,7 @@ class AllAppsList { if (matches.size() > 0) { for (ResolveInfo info : matches) { - add(new ApplicationInfo(context.getPackageManager(), info, mIconCache, null)); + add(new ApplicationInfo(context.getPackageManager(), info, mIconCache, null, "15")); } } } @@ -142,7 +142,7 @@ class AllAppsList { info.activityInfo.applicationInfo.packageName, info.activityInfo.name); if (applicationInfo == null) { - add(new ApplicationInfo(context.getPackageManager(), info, mIconCache, null)); + add(new ApplicationInfo(context.getPackageManager(), info, mIconCache, null, "16")); } else { mIconCache.remove(applicationInfo.componentName); mIconCache.getTitleAndIcon(applicationInfo, info, null); diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java index 1fc1d1f55e..bbca664455 100644 --- a/src/com/android/launcher2/ApplicationInfo.java +++ b/src/com/android/launcher2/ApplicationInfo.java @@ -60,7 +60,8 @@ class ApplicationInfo extends ItemInfo { int flags = 0; - ApplicationInfo() { + ApplicationInfo(String whereCreated) { + super(whereCreated); itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_SHORTCUT; } @@ -68,7 +69,8 @@ class ApplicationInfo extends ItemInfo { * Must not hold the Context. */ public ApplicationInfo(PackageManager pm, ResolveInfo info, IconCache iconCache, - HashMap labelCache) { + HashMap labelCache, String whereCreated) { + super(whereCreated); final String packageName = info.activityInfo.applicationInfo.packageName; this.componentName = new ComponentName(packageName, info.activityInfo.name); @@ -93,8 +95,8 @@ class ApplicationInfo extends ItemInfo { iconCache.getTitleAndIcon(this, info, labelCache); } - public ApplicationInfo(ApplicationInfo info) { - super(info); + public ApplicationInfo(ApplicationInfo info, String whereCreated) { + super(info, whereCreated); componentName = info.componentName; title = info.title.toString(); intent = new Intent(info.intent); @@ -133,6 +135,6 @@ class ApplicationInfo extends ItemInfo { } public ShortcutInfo makeShortcut() { - return new ShortcutInfo(this); + return new ShortcutInfo(this, "18"); } } diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 0e442eaebf..3adf404b54 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -1016,7 +1016,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen if (rawInfo instanceof AppWidgetProviderInfo) { // Fill in the widget information AppWidgetProviderInfo info = (AppWidgetProviderInfo) rawInfo; - createItemInfo = new PendingAddWidgetInfo(info, null, null); + createItemInfo = new PendingAddWidgetInfo(info, null, null, "13"); int[] cellSpans = CellLayout.rectToCell(getResources(), info.minWidth, info.minHeight, null); FastBitmapDrawable preview = new FastBitmapDrawable(data.generatedImages.get(i)); @@ -1026,7 +1026,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } else if (rawInfo instanceof ResolveInfo) { // Fill in the shortcuts information ResolveInfo info = (ResolveInfo) rawInfo; - createItemInfo = new PendingAddItemInfo(); + createItemInfo = new PendingAddItemInfo("14"); createItemInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; createItemInfo.componentName = new ComponentName(info.activityInfo.packageName, info.activityInfo.name); diff --git a/src/com/android/launcher2/FolderInfo.java b/src/com/android/launcher2/FolderInfo.java index 3ae31d2781..0f8b9e06fe 100644 --- a/src/com/android/launcher2/FolderInfo.java +++ b/src/com/android/launcher2/FolderInfo.java @@ -42,7 +42,8 @@ class FolderInfo extends ItemInfo { ArrayList listeners = new ArrayList(); - FolderInfo() { + FolderInfo(String whereCreated) { + super(whereCreated); itemType = LauncherSettings.Favorites.ITEM_TYPE_FOLDER; } diff --git a/src/com/android/launcher2/InstallWidgetReceiver.java b/src/com/android/launcher2/InstallWidgetReceiver.java index 6b3763ce08..1b54e908c9 100644 --- a/src/com/android/launcher2/InstallWidgetReceiver.java +++ b/src/com/android/launcher2/InstallWidgetReceiver.java @@ -187,7 +187,7 @@ public class InstallWidgetReceiver { final AppWidgetProviderInfo widgetInfo = mActivities.get(which).widgetInfo; final PendingAddWidgetInfo createInfo = new PendingAddWidgetInfo(widgetInfo, mMimeType, - mClipData); + mClipData, "4"); mLauncher.addAppWidgetFromDrop(createInfo, LauncherSettings.Favorites.CONTAINER_DESKTOP, mTargetLayoutScreen, null, mTargetLayoutPos); } diff --git a/src/com/android/launcher2/ItemInfo.java b/src/com/android/launcher2/ItemInfo.java index 8d46624955..5c05f163f6 100644 --- a/src/com/android/launcher2/ItemInfo.java +++ b/src/com/android/launcher2/ItemInfo.java @@ -86,10 +86,16 @@ class ItemInfo { */ int[] dropPos = null; - ItemInfo() { + /* + * A tag to know where this item was created + */ + String whereCreated; + + ItemInfo(String whereCreated) { + this.whereCreated = whereCreated; } - ItemInfo(ItemInfo info) { + ItemInfo(ItemInfo info, String whereCreated) { id = info.id; cellX = info.cellX; cellY = info.cellY; @@ -98,6 +104,7 @@ class ItemInfo { screen = info.screen; itemType = info.itemType; container = info.container; + this.whereCreated = whereCreated; } /** diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 22a34e6c7a..eaa98c1b42 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -175,7 +175,7 @@ public final class Launcher extends Activity private AppWidgetManager mAppWidgetManager; private LauncherAppWidgetHost mAppWidgetHost; - private ItemInfo mPendingAddInfo = new ItemInfo(); + private ItemInfo mPendingAddInfo = new ItemInfo("1"); private int[] mTmpAddItemCellCoordinates = new int[2]; private FolderInfo mFolderInfo; @@ -902,7 +902,7 @@ public final class Launcher extends Activity } // Build Launcher-specific widget info and save to database - LauncherAppWidgetInfo launcherInfo = new LauncherAppWidgetInfo(appWidgetId); + LauncherAppWidgetInfo launcherInfo = new LauncherAppWidgetInfo(appWidgetId, "2"); launcherInfo.spanX = spanXY[0]; launcherInfo.spanY = spanXY[1]; @@ -1446,7 +1446,7 @@ public final class Launcher extends Activity FolderIcon addFolder(CellLayout layout, long container, final int screen, int cellX, int cellY) { - final FolderInfo folderInfo = new FolderInfo(); + final FolderInfo folderInfo = new FolderInfo("3"); folderInfo.title = getText(R.string.folder_name); // Update the model diff --git a/src/com/android/launcher2/LauncherAppWidgetInfo.java b/src/com/android/launcher2/LauncherAppWidgetInfo.java index 844abb5190..69eae178ef 100644 --- a/src/com/android/launcher2/LauncherAppWidgetInfo.java +++ b/src/com/android/launcher2/LauncherAppWidgetInfo.java @@ -51,7 +51,8 @@ class LauncherAppWidgetInfo extends ItemInfo { /** * Constructor for use with AppWidgets that haven't been instantiated yet. */ - LauncherAppWidgetInfo(ComponentName providerName) { + LauncherAppWidgetInfo(ComponentName providerName, String whereCreated) { + super(whereCreated); itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; this.providerName = providerName; @@ -61,7 +62,8 @@ class LauncherAppWidgetInfo extends ItemInfo { spanY = -1; } - LauncherAppWidgetInfo(int appWidgetId) { + LauncherAppWidgetInfo(int appWidgetId, String whereCreated) { + super(whereCreated); itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; this.appWidgetId = appWidgetId; } diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 4ad8922f4f..ea51d01694 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -210,8 +210,10 @@ public class LauncherModel extends BroadcastReceiver { // the modelItem needs to match up perfectly with item if our model is to be // consistent with the database-- for now, just require modelItem == item String msg = "item: " + ((item != null) ? item.toString() : "null") + - "modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + - "Error: ItemInfo passed to moveItemInDatabase doesn't match original"; + " modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + + " creation tag of item: " + ((item != null) ? item.whereCreated : "null") + + " creation tag of modelItem: " + ((modelItem != null) ? modelItem.whereCreated : "null") + + " Error: ItemInfo passed to moveItemInDatabase doesn't match original"; throw new RuntimeException(msg); } @@ -258,8 +260,10 @@ public class LauncherModel extends BroadcastReceiver { // the modelItem needs to match up perfectly with item if our model is to be // consistent with the database-- for now, just require modelItem == item String msg = "item: " + ((item != null) ? item.toString() : "null") + - "modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + - "Error: ItemInfo passed to resizeItemInDatabase doesn't match original"; + " modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + + " creation tag of item: " + ((item != null) ? item.whereCreated : "null") + + " creation tag of modelItem: " + ((modelItem != null) ? modelItem.whereCreated : "null") + + " Error: ItemInfo passed to resizeItemInDatabase doesn't match original"; throw new RuntimeException(msg); } } @@ -306,7 +310,7 @@ public class LauncherModel extends BroadcastReceiver { try { while (c.moveToNext()) { - ItemInfo item = new ItemInfo(); + ItemInfo item = new ItemInfo("17"); item.cellX = c.getInt(cellXIndex); item.cellY = c.getInt(cellYIndex); item.spanX = c.getInt(spanXIndex); @@ -470,8 +474,10 @@ public class LauncherModel extends BroadcastReceiver { // the modelItem needs to match up perfectly with item if our model is to be // consistent with the database-- for now, just require modelItem == item String msg = "item: " + ((item != null) ? item.toString() : "null") + - "modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + - "Error: ItemInfo passed to updateItemInDatabase doesn't match original"; + " modelItem: " + ((modelItem != null) ? modelItem.toString() : "null") + + " creation tag of item: " + ((item != null) ? item.whereCreated : "null") + + " creation tag of modelItem: " + ((modelItem != null) ? modelItem.whereCreated : "null") + + " Error: ItemInfo passed to updateItemInDatabase doesn't match original"; throw new RuntimeException(msg); } } @@ -1059,7 +1065,7 @@ public class LauncherModel extends BroadcastReceiver { + id + " appWidgetId=" + appWidgetId); itemsToRemove.add(id); } else { - appWidgetInfo = new LauncherAppWidgetInfo(appWidgetId); + appWidgetInfo = new LauncherAppWidgetInfo(appWidgetId, "5"); appWidgetInfo.id = id; appWidgetInfo.screen = c.getInt(screenIndex); appWidgetInfo.cellX = c.getInt(cellXIndex); @@ -1345,7 +1351,7 @@ public class LauncherModel extends BroadcastReceiver { for (int j=0; i labelCache) { Bitmap icon = null; - final ShortcutInfo info = new ShortcutInfo(); + final ShortcutInfo info = new ShortcutInfo("7"); ComponentName componentName = intent.getComponent(); if (componentName == null) { @@ -1606,7 +1612,7 @@ public class LauncherModel extends BroadcastReceiver { int titleIndex) { Bitmap icon = null; - final ShortcutInfo info = new ShortcutInfo(); + final ShortcutInfo info = new ShortcutInfo("8"); info.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; // TODO: If there's an explicit component and we can't install that, delete it. @@ -1765,7 +1771,7 @@ public class LauncherModel extends BroadcastReceiver { } } - final ShortcutInfo info = new ShortcutInfo(); + final ShortcutInfo info = new ShortcutInfo("9"); if (icon == null) { if (fallbackIcon != null) { @@ -1833,7 +1839,7 @@ public class LauncherModel extends BroadcastReceiver { FolderInfo folderInfo = folders.get(id); if (folderInfo == null) { // No placeholder -- create a new instance - folderInfo = new FolderInfo(); + folderInfo = new FolderInfo("10"); folders.put(id, folderInfo); } return folderInfo; diff --git a/src/com/android/launcher2/PendingAddItemInfo.java b/src/com/android/launcher2/PendingAddItemInfo.java index 7b564e0518..6ee300bfae 100644 --- a/src/com/android/launcher2/PendingAddItemInfo.java +++ b/src/com/android/launcher2/PendingAddItemInfo.java @@ -28,6 +28,10 @@ class PendingAddItemInfo extends ItemInfo { * The component that will be created. */ ComponentName componentName; + + public PendingAddItemInfo(String whereCreated) { + super(whereCreated); + } } class PendingAddWidgetInfo extends PendingAddItemInfo { @@ -39,7 +43,9 @@ class PendingAddWidgetInfo extends PendingAddItemInfo { String mimeType; Parcelable configurationData; - public PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data) { + public PendingAddWidgetInfo( + AppWidgetProviderInfo i, String dataMimeType, Parcelable data, String whereCreated) { + super(whereCreated); itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; componentName = i.provider; minWidth = i.minWidth; diff --git a/src/com/android/launcher2/ShortcutInfo.java b/src/com/android/launcher2/ShortcutInfo.java index c0f80aeec6..6d4853ff41 100644 --- a/src/com/android/launcher2/ShortcutInfo.java +++ b/src/com/android/launcher2/ShortcutInfo.java @@ -62,12 +62,14 @@ class ShortcutInfo extends ItemInfo { */ private Bitmap mIcon; - ShortcutInfo() { + ShortcutInfo(String whereCreated) { + super(whereCreated); itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_SHORTCUT; + this.whereCreated = whereCreated; } - public ShortcutInfo(ShortcutInfo info) { - super(info); + public ShortcutInfo(ShortcutInfo info, String whereCreated) { + super(info, whereCreated); title = info.title.toString(); intent = new Intent(info.intent); if (info.iconResource != null) { @@ -80,8 +82,8 @@ class ShortcutInfo extends ItemInfo { } /** TODO: Remove this. It's only called by ApplicationInfo.makeShortcut. */ - public ShortcutInfo(ApplicationInfo info) { - super(info); + public ShortcutInfo(ApplicationInfo info, String whereCreated) { + super(info, whereCreated); title = info.title.toString(); intent = new Intent(info.intent); customIcon = false; diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 1c13f14095..3e0b466e6a 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -2575,7 +2575,7 @@ public class Workspace extends SmoothPagedView // that widget final AppWidgetProviderInfo widgetInfo = widgets.get(0).widgetInfo; final PendingAddWidgetInfo createInfo = - new PendingAddWidgetInfo(widgetInfo, mimeType, data); + new PendingAddWidgetInfo(widgetInfo, mimeType, data, "11"); mLauncher.addAppWidgetFromDrop(createInfo, LauncherSettings.Favorites.CONTAINER_DESKTOP, mCurrentPage, null, pos); } else { @@ -3091,7 +3091,7 @@ public class Workspace extends SmoothPagedView case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: if (info.container == NO_ID && info instanceof ApplicationInfo) { // Came from all apps -- make a copy - info = new ShortcutInfo((ApplicationInfo) info); + info = new ShortcutInfo((ApplicationInfo) info, "12"); } view = mLauncher.createShortcut(R.layout.application, cellLayout, (ShortcutInfo) info);