summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r--src/com/android/launcher2/AllAppsList.java4
-rw-r--r--src/com/android/launcher2/ApplicationInfo.java12
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java4
-rw-r--r--src/com/android/launcher2/FolderInfo.java3
-rw-r--r--src/com/android/launcher2/InstallWidgetReceiver.java2
-rw-r--r--src/com/android/launcher2/ItemInfo.java11
-rw-r--r--src/com/android/launcher2/Launcher.java54
-rw-r--r--src/com/android/launcher2/LauncherAppWidgetHostView.java19
-rw-r--r--src/com/android/launcher2/LauncherAppWidgetInfo.java6
-rw-r--r--src/com/android/launcher2/LauncherModel.java40
-rw-r--r--src/com/android/launcher2/PendingAddItemInfo.java8
-rw-r--r--src/com/android/launcher2/ShortcutInfo.java12
-rw-r--r--src/com/android/launcher2/Workspace.java4
13 files changed, 120 insertions, 59 deletions
diff --git a/src/com/android/launcher2/AllAppsList.java b/src/com/android/launcher2/AllAppsList.java
index 051b0bd1d..7c107a79a 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 1fc1d1f55..bbca66445 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<Object, CharSequence> labelCache) {
+ HashMap<Object, CharSequence> 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 0e442eaeb..3adf404b5 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 3ae31d278..0f8b9e06f 100644
--- a/src/com/android/launcher2/FolderInfo.java
+++ b/src/com/android/launcher2/FolderInfo.java
@@ -42,7 +42,8 @@ class FolderInfo extends ItemInfo {
ArrayList<FolderListener> listeners = new ArrayList<FolderListener>();
- 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 6b3763ce0..1b54e908c 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 8d4662495..5c05f163f 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 22a34e6c7..f05850b36 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -52,6 +52,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
+import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
@@ -74,8 +75,8 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
-import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
+import android.view.View.OnLongClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
@@ -175,7 +176,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;
@@ -729,8 +730,6 @@ public final class Launcher extends Activity
}
}
-
-
/**
* Creates a view representing a shortcut.
*
@@ -845,6 +844,39 @@ public final class Launcher extends Activity
}
}
+ class Padding {
+ int left = 0;
+ int right = 0;
+ int top = 0;
+ int bottom = 0;
+ }
+
+ Padding getPaddingForWidget(AppWidgetProviderInfo widgetInfo) {
+ PackageManager packageManager = getPackageManager();
+ Padding p = new Padding();
+ android.content.pm.ApplicationInfo appInfo;
+
+ try {
+ appInfo = packageManager.getApplicationInfo(
+ widgetInfo.provider.getPackageName(), 0);
+ } catch (Exception e) {
+ // if we can't find the package, return 0 padding
+ return p;
+ }
+
+ // TODO: This should be ICE_CREAM_SANDWICH, but since the unbundled apps
+ // may not have updated their targetSdkVersion yet, we've bumped it down for now.
+ if (appInfo.targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB_MR2) {
+ Resources r = getResources();
+ p.left = r.getDimensionPixelSize(R.dimen.app_widget_padding_left);
+ p.right = r.getDimensionPixelSize(R.dimen.app_widget_padding_right);
+ p.top = r.getDimensionPixelSize(R.dimen.app_widget_padding_top);
+ p.bottom = r.getDimensionPixelSize(R.dimen.app_widget_padding_bottom);
+ }
+
+ return p;
+ }
+
/**
* Add a widget to the workspace.
*
@@ -857,15 +889,11 @@ public final class Launcher extends Activity
// Calculate the grid spans needed to fit this widget
CellLayout layout = getCellLayout(container, screen);
+ Padding padding = getPaddingForWidget(appWidgetInfo);
// We want to account for the extra amount of padding that we are adding to the widget
// to ensure that it gets the full amount of space that it has requested
- Resources r = getResources();
- int requiredWidth = appWidgetInfo.minWidth +
- r.getDimensionPixelSize(R.dimen.app_widget_padding_left) +
- r.getDimensionPixelSize(R.dimen.app_widget_padding_right);
- int requiredHeight = appWidgetInfo.minHeight +
- r.getDimensionPixelSize(R.dimen.app_widget_padding_top) +
- r.getDimensionPixelSize(R.dimen.app_widget_padding_bottom);
+ int requiredWidth = appWidgetInfo.minWidth + padding.left + padding.right;
+ int requiredHeight = appWidgetInfo.minHeight + padding.top + padding.bottom;
int[] spanXY = layout.rectToCell(requiredWidth, requiredHeight, null);
// Try finding open space on Launcher screen
@@ -902,7 +930,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 +1474,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/LauncherAppWidgetHostView.java b/src/com/android/launcher2/LauncherAppWidgetHostView.java
index 7c3b993ce..a84ced671 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHostView.java
@@ -17,6 +17,7 @@
package com.android.launcher2;
import android.appwidget.AppWidgetHostView;
+import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
@@ -26,6 +27,7 @@ import android.view.ViewConfiguration;
import android.view.ViewGroup;
import com.android.launcher.R;
+import com.android.launcher2.Launcher.Padding;
/**
* {@inheritDoc}
@@ -34,17 +36,12 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView {
private boolean mHasPerformedLongPress;
private CheckForLongPress mPendingCheckForLongPress;
private LayoutInflater mInflater;
+ private Launcher mLauncher;
public LauncherAppWidgetHostView(Context context) {
super(context);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- Resources r = context.getResources();
- // We add necessary padding to the AppWidgetHostView
- setPadding(r.getDimensionPixelSize(R.dimen.app_widget_padding_left),
- r.getDimensionPixelSize(R.dimen.app_widget_padding_top),
- r.getDimensionPixelSize(R.dimen.app_widget_padding_right),
- r.getDimensionPixelSize(R.dimen.app_widget_padding_bottom));
+ mLauncher = (Launcher) context;
}
@Override
@@ -119,6 +116,14 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView {
}
@Override
+ public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) {
+ super.setAppWidget(appWidgetId, info);
+ // We add necessary padding to the AppWidgetHostView
+ Launcher.Padding padding = mLauncher.getPaddingForWidget(info);
+ setPadding(padding.left, padding.top, padding.right, padding.bottom);
+ }
+
+ @Override
public int getDescendantFocusability() {
return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
diff --git a/src/com/android/launcher2/LauncherAppWidgetInfo.java b/src/com/android/launcher2/LauncherAppWidgetInfo.java
index 844abb519..69eae178e 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 7d6206222..ea51d0169 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);
}
}
@@ -605,9 +611,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();
+ }
}
}
}
@@ -1057,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);
@@ -1343,7 +1351,7 @@ public class LauncherModel extends BroadcastReceiver {
for (int j=0; i<N && j<batchSize; j++) {
// This builds the icon bitmaps.
mAllAppsList.add(new ApplicationInfo(packageManager, apps.get(i),
- mIconCache, mLabelCache));
+ mIconCache, mLabelCache, "6"));
i++;
}
@@ -1539,7 +1547,7 @@ public class LauncherModel extends BroadcastReceiver {
public ShortcutInfo getShortcutInfo(PackageManager manager, Intent intent, Context context,
Cursor c, int iconIndex, int titleIndex, HashMap<Object, CharSequence> labelCache) {
Bitmap icon = null;
- final ShortcutInfo info = new ShortcutInfo();
+ final ShortcutInfo info = new ShortcutInfo("7");
ComponentName componentName = intent.getComponent();
if (componentName == null) {
@@ -1604,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.
@@ -1763,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) {
@@ -1831,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 7b564e051..6ee300bfa 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 c0f80aeec..6d4853ff4 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 1c13f1409..3e0b466e6 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);