Decoupling launcher/workspace package cleanup from the application list (Bug 6602756)

- Fixes issues where shortcuts created by wallpaper/widget-only apps are uninstalled.

Change-Id: I94c9d1d71fc34aa2fb7f0660534e616a82ac6f36
This commit is contained in:
Winson Chung
2012-06-18 16:45:43 -07:00
parent 23a8d1eece
commit cd81073eac
6 changed files with 45 additions and 106 deletions
@@ -326,19 +326,17 @@ public class DragController {
}
endDrag();
}
public void onAppsRemoved(ArrayList<ApplicationInfo> apps, Context context) {
public void onAppsRemoved(ArrayList<String> packageNames, Context context) {
// Cancel the current drag if we are removing an app that we are dragging
if (mDragObject != null) {
Object rawDragInfo = mDragObject.dragInfo;
if (rawDragInfo instanceof ShortcutInfo) {
ShortcutInfo dragInfo = (ShortcutInfo) rawDragInfo;
for (ApplicationInfo info : apps) {
for (String pn : packageNames) {
// Added null checks to prevent NPE we've seen in the wild
if (dragInfo != null &&
dragInfo.intent != null &&
info.intent != null) {
boolean isSamePackage = dragInfo.getPackageName().equals(
info.getPackageName());
dragInfo.intent != null) {
boolean isSamePackage = dragInfo.getPackageName().equals(pn);
if (isSamePackage) {
cancelDrag();
return;