diff options
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 909cf5f8c..7b4e432d3 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -4921,6 +4921,38 @@ public class Workspace extends SmoothPagedView removeItemsByPackageName(packages, user); } + public void updatePackageBadge(final String packageName, final UserHandleCompat user) { + 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, true); + } 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(); + } + } + } + // process all the shortcuts + return false; + } + }); + } + public void updatePackageState(ArrayList<PackageInstallInfo> installInfos) { HashSet<String> completedPackages = new HashSet<String>(); |