diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-01-18 11:30:23 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-01-18 11:30:59 -0800 |
commit | 1b0726359b5157db8d3d96c52a37f05fce065618 (patch) | |
tree | 976beb740a63b928e35c41d026d7ea5af00222f8 /src/com/android/launcher3/ShortcutInfo.java | |
parent | a3db1fc674ed9a09cf1fae880506673cb7d8f83f (diff) | |
download | android_packages_apps_Trebuchet-1b0726359b5157db8d3d96c52a37f05fce065618.tar.gz android_packages_apps_Trebuchet-1b0726359b5157db8d3d96c52a37f05fce065618.tar.bz2 android_packages_apps_Trebuchet-1b0726359b5157db8d3d96c52a37f05fce065618.zip |
Moving icon generation out of ShortcutInfo constructor so that it
can be created on the UI thread
Change-Id: If84e52041eb4ab20807f5cfd4b7f31d7b5f381ed
Diffstat (limited to 'src/com/android/launcher3/ShortcutInfo.java')
-rw-r--r-- | src/com/android/launcher3/ShortcutInfo.java | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java index 976d73344..1a423957a 100644 --- a/src/com/android/launcher3/ShortcutInfo.java +++ b/src/com/android/launcher3/ShortcutInfo.java @@ -17,21 +17,13 @@ package com.android.launcher3; import android.annotation.TargetApi; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; import android.os.Build; -import android.os.Process; -import android.os.UserHandle; import android.text.TextUtils; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.compat.UserManagerCompat; -import com.android.launcher3.graphics.LauncherIcons; -import com.android.launcher3.model.PackageItemInfo; -import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.shortcuts.ShortcutInfoCompat; import com.android.launcher3.util.ContentWriter; @@ -225,42 +217,6 @@ public class ShortcutInfo extends ItemInfoWithIcon { isDisabled |= FLAG_DISABLED_BY_PUBLISHER; } disabledMessage = shortcutInfo.getDisabledMessage(); - - // TODO: Use cache for this - LauncherAppState launcherAppState = LauncherAppState.getInstance(context); - Drawable unbadgedDrawable = DeepShortcutManager.getInstance(context) - .getShortcutIconDrawable(shortcutInfo, - launcherAppState.getInvariantDeviceProfile().fillResIconDpi); - - IconCache cache = launcherAppState.getIconCache(); - Bitmap unbadgedBitmap = unbadgedDrawable == null - ? cache.getDefaultIcon(Process.myUserHandle()) - : LauncherIcons.createScaledBitmapWithoutShadow(unbadgedDrawable, context); - iconBitmap = getBadgedIcon(unbadgedBitmap, shortcutInfo, cache, context); - } - - protected Bitmap getBadgedIcon(Bitmap unbadgedBitmap, ShortcutInfoCompat shortcutInfo, - IconCache cache, Context context) { - unbadgedBitmap = LauncherIcons.addShadowToIcon(unbadgedBitmap, context); - - final Bitmap badgeBitmap; - ComponentName cn = shortcutInfo.getActivity(); - if (cn != null) { - // Get the app info for the source activity. - AppInfo appInfo = new AppInfo(); - appInfo.user = user; - appInfo.componentName = cn; - appInfo.intent = new Intent(Intent.ACTION_MAIN) - .addCategory(Intent.CATEGORY_LAUNCHER) - .setComponent(cn); - cache.getTitleAndIcon(appInfo, false); - badgeBitmap = appInfo.iconBitmap; - } else { - PackageItemInfo pkgInfo = new PackageItemInfo(shortcutInfo.getPackage()); - cache.getTitleAndIconForApp(pkgInfo, false); - badgeBitmap = pkgInfo.iconBitmap; - } - return LauncherIcons.badgeWithBitmap(unbadgedBitmap, badgeBitmap, context); } /** Returns the ShortcutInfo id associated with the deep shortcut. */ |