Fixing issue where items that were not yet added were not removed from the db. (Bug 6428418)

Change-Id: I8f76af1ccaa2bc5053f3e1f6606202310855aaae
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index b76df39..ff4abc6 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -1675,6 +1675,24 @@
     }
 
     /**
+     * Returns all the Workspace ShortcutInfos associated with a particular package.
+     * @param intent
+     * @return
+     */
+    ArrayList<ShortcutInfo> getShortcutInfosForPackage(String packageName) {
+        ArrayList<ShortcutInfo> infos = new ArrayList<ShortcutInfo>();
+        for (ItemInfo i : sWorkspaceItems) {
+            if (i instanceof ShortcutInfo) {
+                ShortcutInfo info = (ShortcutInfo) i;
+                if (info.intent.getPackage().equals(packageName)) {
+                    infos.add(info);
+                }
+            }
+        }
+        return infos;
+    }
+
+    /**
      * This is called from the code that adds shortcuts from the intent receiver.  This
      * doesn't have a Cursor, but
      */