diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-21 18:30:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-21 18:30:20 +0000 |
commit | 1231c0743cce0b6b70951d1df3e4b0876c444598 (patch) | |
tree | dc7a3d946c5f4b6aff857995e026ed91d6688c10 /src/com/android/launcher3/Launcher.java | |
parent | e75e7ab4fd6f38cb99382c3b16300fd0f2ef6307 (diff) | |
parent | 4390acea35aefae52bd3fe38f5fdbb7ea322afb0 (diff) | |
download | android_packages_apps_Trebuchet-1231c0743cce0b6b70951d1df3e4b0876c444598.tar.gz android_packages_apps_Trebuchet-1231c0743cce0b6b70951d1df3e4b0876c444598.tar.bz2 android_packages_apps_Trebuchet-1231c0743cce0b6b70951d1df3e4b0876c444598.zip |
Merge "Updating ItemInfo objects in the worker thread" into ub-now-queens
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index be845400d..178f6cb56 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -125,6 +125,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; @@ -2063,7 +2064,6 @@ public class Launcher extends Activity mWorkspace = null; mDragController = null; - PackageInstallerCompat.getInstance(this).onStop(); LauncherAnimUtils.onDestroyActivity(); if (mLauncherCallbacks != null) { @@ -4858,33 +4858,54 @@ public class Launcher extends Activity return; } - if (mWorkspace != null) { - mWorkspace.updateShortcutsAndWidgets(apps); - } - if (!LauncherAppState.isDisableAllApps() && mAppsCustomizeContent != null) { mAppsCustomizeContent.updateApps(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); + } + /** * Some shortcuts were updated in the background. * * 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); } } @@ -4935,19 +4956,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) { |