Commit 6323a55f authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Fixing issue where we were not removing items from LauncherModel and...

Merge "Fixing issue where we were not removing items from LauncherModel and only the add-queue. (Bug 7078244)" into jb-mr1-dev
parents 7a397e04 8a435106
......@@ -2167,6 +2167,24 @@ public class LauncherModel extends BroadcastReceiver {
return info;
}
/**
* 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.
*/
......
......@@ -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) {}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment