diff options
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 5236ede22..2af40c44d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -143,6 +143,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -2417,7 +2418,6 @@ public class Launcher extends Activity mWorkspace = null; mDragController = null; - PackageInstallerCompat.getInstance(this).onStop(); LauncherAnimUtils.onDestroyActivity(); if (mLauncherCallbacks != null) { @@ -5579,10 +5579,6 @@ public class Launcher extends Activity return; } - if (mWorkspace != null) { - mWorkspace.updateShortcutsAndWidgets(apps); - } - if (!LauncherAppState.isDisableAllApps() && mAppsCustomizeContent != null) { mAppsCustomizeContent.updateApps(apps); @@ -5602,10 +5598,19 @@ public class Launcher extends Activity if (waitUntilResume(r)) { return; } + } - if (mWorkspace != null) { - mWorkspace.updateShortcutsAndWidgets(apps); + @Override + public void bindWidgetsRestored(final ArrayList<LauncherAppWidgetInfo> widgets) { + Runnable r = new Runnable() { + public void run() { + bindWidgetsRestored(widgets); + } + }; + if (waitUntilResume(r)) { + return; } + mWorkspace.widgetsRestored(widgets); } /** @@ -5613,18 +5618,30 @@ public class Launcher extends Activity * * Implementation of the method from LauncherModel.Callbacks. */ - public void bindShortcutsUpdated(final ArrayList<ShortcutInfo> shortcuts) { + @Override + public void bindShortcutsChanged(final ArrayList<ShortcutInfo> updated, + final ArrayList<ShortcutInfo> removed, final UserHandleCompat user) { Runnable r = new Runnable() { public void run() { - bindShortcutsUpdated(shortcuts); + bindShortcutsChanged(updated, removed, user); } }; if (waitUntilResume(r)) { return; } - if (mWorkspace != null) { - mWorkspace.updateShortcuts(shortcuts); + if (!updated.isEmpty()) { + mWorkspace.updateShortcuts(updated); + } + + if (!removed.isEmpty()) { + HashSet<ComponentName> removedComponents = new HashSet<ComponentName>(); + for (ShortcutInfo si : removed) { + removedComponents.add(si.getTargetComponent()); + } + mWorkspace.removeItemsByComponentName(removedComponents, user); + // Notify the drag controller + mDragController.onAppsRemoved(new ArrayList<String>(), removedComponents); } } @@ -5675,19 +5692,23 @@ public class Launcher extends Activity } if (reason == 0) { + HashSet<ComponentName> removedComponents = new HashSet<ComponentName>(); + for (AppInfo info : appInfos) { + removedComponents.add(info.componentName); + } if (!packageNames.isEmpty()) { mWorkspace.removeItemsByPackageName(packageNames, user); } - if (!appInfos.isEmpty()) { - mWorkspace.removeItemsByApplicationInfo(appInfos, user); + if (!removedComponents.isEmpty()) { + mWorkspace.removeItemsByComponentName(removedComponents, user); } + // Notify the drag controller + mDragController.onAppsRemoved(packageNames, removedComponents); + } else { mWorkspace.disableShortcutsByPackageName(packageNames, user, reason); } - // Notify the drag controller - mDragController.onAppsRemoved(packageNames, appInfos); - // Update AllApps if (!LauncherAppState.isDisableAllApps() && mAppsCustomizeContent != null) { |