diff options
author | Winson Chung <winsonc@google.com> | 2012-08-30 17:16:53 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2012-08-30 17:18:59 -0700 |
commit | 8a4351063f02c0e8d64ee3ace651b227e9f8321f (patch) | |
tree | 858c35e20f1c1a32f1319a8eb38976d2d3f0efa3 | |
parent | 5a0f45fe278e697cd5d8088da23a4321b3acf991 (diff) | |
download | packages_apps_trebuchet-8a4351063f02c0e8d64ee3ace651b227e9f8321f.zip packages_apps_trebuchet-8a4351063f02c0e8d64ee3ace651b227e9f8321f.tar.gz packages_apps_trebuchet-8a4351063f02c0e8d64ee3ace651b227e9f8321f.tar.bz2 |
Fixing issue where we were not removing items from LauncherModel and only the add-queue. (Bug 7078244)
Change-Id: I5660b447521646f820fb2497f327e965d99ac207
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 18 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 10 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 269a0fd..909cc79 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -2168,6 +2168,24 @@ public class LauncherModel extends BroadcastReceiver { } /** + * Returns the set of workspace ShortcutInfos with the specified intent. + */ + static ArrayList<ItemInfo> getWorkspaceShortcutItemInfosWithIntent(Intent intent) { + ArrayList<ItemInfo> items = new ArrayList<ItemInfo>(); + synchronized (sBgLock) { + for (ItemInfo info : sBgWorkspaceItems) { + if (info instanceof ShortcutInfo) { + ShortcutInfo shortcut = (ShortcutInfo) info; + if (shortcut.intent.toUri(0).equals(intent.toUri(0))) { + items.add(shortcut); + } + } + } + } + return items; + } + + /** * Make an ShortcutInfo object for a shortcut that isn't an application. */ private ShortcutInfo getShortcutInfo(Cursor c, Context context, diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 504f9dc..897e95a 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -3697,6 +3697,8 @@ public class Workspace extends SmoothPagedView } // Clean up new-apps animation list + final LauncherModel model = mLauncher.getModel(); + final Context context = getContext(); post(new Runnable() { @Override public void run() { @@ -3717,6 +3719,14 @@ public class Workspace extends SmoothPagedView if (packageNames.contains(pn)) { iter.remove(); } + + // It is possible that we've queued an item to be loaded, yet it has + // not been added to the workspace, so remove those items as well. + ArrayList<ItemInfo> shortcuts = + model.getWorkspaceShortcutItemInfosWithIntent(intent); + for (ItemInfo info : shortcuts) { + model.deleteItemFromDatabase(context, info); + } } catch (URISyntaxException e) {} } } |