diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-04-16 15:20:51 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-04-22 10:08:14 -0700 |
commit | 756adbc3e41ee1edb53c580b8c679f343924fab5 (patch) | |
tree | ab8f8180f393dad6586e31c14aac4905ad3eb44d /src/com/android/launcher3/IconCache.java | |
parent | 7372fc659ed16c2e14a64a3d78a2c63554005844 (diff) | |
download | android_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/IconCache.java')
-rw-r--r-- | src/com/android/launcher3/IconCache.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java index 48b38f182..fd4571482 100644 --- a/src/com/android/launcher3/IconCache.java +++ b/src/com/android/launcher3/IconCache.java @@ -101,7 +101,7 @@ public class IconCache { mIconDpi = activityManager.getLauncherLargeIconDensity(); mIconDb = new IconDB(context); - mWorkerHandler = new Handler(LauncherModel.sWorkerThread.getLooper()); + mWorkerHandler = new Handler(LauncherModel.getWorkerLooper()); } private Drawable getFullResDefaultActivityIcon() { @@ -388,16 +388,20 @@ public class IconCache { return new IconLoadRequest(request, mWorkerHandler); } + private Bitmap getNonNullIcon(CacheEntry entry, UserHandleCompat user) { + return entry.icon == null ? getDefaultIcon(user) : entry.icon; + } + /** * Fill in "application" with the icon and label for "info." */ public synchronized void getTitleAndIcon(AppInfo application, LauncherActivityInfoCompat info, boolean useLowResIcon) { - CacheEntry entry = cacheLocked(application.componentName, info, - info == null ? application.user : info.getUser(), + UserHandleCompat user = info == null ? application.user : info.getUser(); + CacheEntry entry = cacheLocked(application.componentName, info, user, false, useLowResIcon); application.title = entry.title; - application.iconBitmap = entry.icon; + application.iconBitmap = getNonNullIcon(entry, user); application.contentDescription = entry.contentDescription; application.usingLowResIcon = entry.isLowResIcon; } @@ -445,7 +449,7 @@ public class IconCache { ShortcutInfo shortcutInfo, ComponentName component, LauncherActivityInfoCompat info, UserHandleCompat user, boolean usePkgIcon, boolean useLowResIcon) { CacheEntry entry = cacheLocked(component, info, user, usePkgIcon, useLowResIcon); - shortcutInfo.setIcon(entry.icon); + shortcutInfo.setIcon(getNonNullIcon(entry, user)); shortcutInfo.title = entry.title; shortcutInfo.usingFallbackIcon = isDefaultIcon(entry.icon, user); shortcutInfo.usingLowResIcon = entry.isLowResIcon; @@ -458,7 +462,7 @@ public class IconCache { String packageName, UserHandleCompat user, boolean useLowResIcon, PackageItemInfo infoOut) { CacheEntry entry = getEntryForPackageLocked(packageName, user, useLowResIcon); - infoOut.iconBitmap = entry.icon; + infoOut.iconBitmap = getNonNullIcon(entry, user); infoOut.title = entry.title; infoOut.usingLowResIcon = entry.isLowResIcon; infoOut.contentDescription = entry.contentDescription; |