summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Workspace.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-04-16 15:20:51 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-04-22 10:08:14 -0700
commit756adbc3e41ee1edb53c580b8c679f343924fab5 (patch)
treeab8f8180f393dad6586e31c14aac4905ad3eb44d /src/com/android/launcher3/Workspace.java
parent7372fc659ed16c2e14a64a3d78a2c63554005844 (diff)
downloadandroid_packages_apps_Trebuchet-756adbc3e41ee1edb53c580b8c679f343924fab5.tar.gz
android_packages_apps_Trebuchet-756adbc3e41ee1edb53c580b8c679f343924fab5.tar.bz2
android_packages_apps_Trebuchet-756adbc3e41ee1edb53c580b8c679f343924fab5.zip
Fixing missing updates in package install sessions
> Ensure icon cache never returns null icon > Enabling install shortuct receiver only after workspace has finished binding > Making all the model changes for package installs on worker thread and only posting the updaes on the UI > Making shortcut exists check on the loaded items and not on the DB > Explicitely using worker thread for PckageInstallListener > Removing backward compatibility support from PackageInstallerCompat Change-Id: I9592771b9670c1c1c84c8208cae8dafa7b393e65
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r--src/com/android/launcher3/Workspace.java69
1 files changed, 8 insertions, 61 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 9e680fb82..abb8489fd 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -62,8 +62,6 @@ import com.android.launcher3.Launcher.CustomContentCallbacks;
import com.android.launcher3.Launcher.LauncherOverlay;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.UninstallDropTarget.UninstallSource;
-import com.android.launcher3.compat.PackageInstallerCompat;
-import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.WallpaperUtils;
@@ -4358,32 +4356,17 @@ public class Workspace extends SmoothPagedView
removeItemsByPackageName(packages, user);
}
- public void updatePackageBadge(final String packageName, final UserHandleCompat user) {
+ public void updateRestoreItems(final HashSet<ItemInfo> updates) {
mapOverItems(MAP_RECURSE, new ItemOperator() {
@Override
public boolean evaluate(ItemInfo info, View v, View parent) {
- if (info instanceof ShortcutInfo && v instanceof BubbleTextView) {
- ShortcutInfo shortcutInfo = (ShortcutInfo) info;
- ComponentName cn = shortcutInfo.getTargetComponent();
- if (user.equals(shortcutInfo.user) && cn != null
- && shortcutInfo.isPromise()
- && packageName.equals(cn.getPackageName())) {
- if (shortcutInfo.hasStatusFlag(ShortcutInfo.FLAG_AUTOINTALL_ICON)) {
- // For auto install apps update the icon as well as label.
- mIconCache.getTitleAndIcon(shortcutInfo,
- shortcutInfo.promisedIntent, user,
- shortcutInfo.shouldUseLowResIcon());
- } else {
- // Only update the icon for restored apps.
- shortcutInfo.updateIcon(mIconCache);
- }
- BubbleTextView shortcut = (BubbleTextView) v;
- shortcut.applyFromShortcutInfo(shortcutInfo, mIconCache, true, false);
-
- if (parent != null) {
- parent.invalidate();
- }
- }
+ if (info instanceof ShortcutInfo && v instanceof BubbleTextView
+ && updates.contains(info)) {
+ ((BubbleTextView) v).applyState(false);
+ } else if (v instanceof PendingAppWidgetHostView
+ && info instanceof LauncherAppWidgetInfo
+ && updates.contains(info)) {
+ ((PendingAppWidgetHostView) v).applyState();
}
// process all the shortcuts
return false;
@@ -4391,42 +4374,6 @@ public class Workspace extends SmoothPagedView
});
}
- public void updatePackageState(ArrayList<PackageInstallInfo> installInfos) {
- for (final PackageInstallInfo installInfo : installInfos) {
- if (installInfo.state == PackageInstallerCompat.STATUS_INSTALLED) {
- continue;
- }
-
- mapOverItems(MAP_RECURSE, new ItemOperator() {
- @Override
- public boolean evaluate(ItemInfo info, View v, View parent) {
- if (info instanceof ShortcutInfo && v instanceof BubbleTextView) {
- ShortcutInfo si = (ShortcutInfo) info;
- ComponentName cn = si.getTargetComponent();
- if (si.isPromise() && (cn != null)
- && installInfo.packageName.equals(cn.getPackageName())) {
- si.setInstallProgress(installInfo.progress);
- if (installInfo.state == PackageInstallerCompat.STATUS_FAILED) {
- // Mark this info as broken.
- si.status &= ~ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE;
- }
- ((BubbleTextView)v).applyState(false);
- }
- } else if (v instanceof PendingAppWidgetHostView
- && info instanceof LauncherAppWidgetInfo
- && ((LauncherAppWidgetInfo) info).providerName.getPackageName()
- .equals(installInfo.packageName)) {
- ((LauncherAppWidgetInfo) info).installProgress = installInfo.progress;
- ((PendingAppWidgetHostView) v).applyState();
- }
-
- // process all the shortcuts
- return false;
- }
- });
- }
- }
-
void widgetsRestored(ArrayList<LauncherAppWidgetInfo> changedInfo) {
if (!changedInfo.isEmpty()) {
DeferredWidgetRefresh widgetRefresh = new DeferredWidgetRefresh(changedInfo,