summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/graphics/LauncherIcons.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-11-09 10:43:58 -0800
committerSunny Goyal <sunnygoyal@google.com>2016-12-13 10:31:12 -0800
commit1cd01b023acc123b771765b7297d8aaedac224e0 (patch)
tree9f275f4cbf290c7fb7e67a913bba14079abcd982 /src/com/android/launcher3/graphics/LauncherIcons.java
parent824c540f1911101321ebe7f05cb0885a4922e363 (diff)
downloadandroid_packages_apps_Trebuchet-1cd01b023acc123b771765b7297d8aaedac224e0.tar.gz
android_packages_apps_Trebuchet-1cd01b023acc123b771765b7297d8aaedac224e0.tar.bz2
android_packages_apps_Trebuchet-1cd01b023acc123b771765b7297d8aaedac224e0.zip
Ensuring that ShortcutInfo always has an icon
> Making iconBitmap public instead of a getter (similar to AppInfo) > Removing getIcon() which can lead to IO on UI thread > Removing updateIcon and handling the update at the caller Bug: 21325319 Change-Id: I6a49b9043f974e9629ea25e77012d97cc04c0594
Diffstat (limited to 'src/com/android/launcher3/graphics/LauncherIcons.java')
-rw-r--r--src/com/android/launcher3/graphics/LauncherIcons.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/com/android/launcher3/graphics/LauncherIcons.java b/src/com/android/launcher3/graphics/LauncherIcons.java
index 9f3f3571d..6f9f7ffc9 100644
--- a/src/com/android/launcher3/graphics/LauncherIcons.java
+++ b/src/com/android/launcher3/graphics/LauncherIcons.java
@@ -18,6 +18,7 @@ package com.android.launcher3.graphics;
import android.annotation.TargetApi;
import android.content.Context;
+import android.content.Intent.ShortcutIconResource;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.Cursor;
@@ -66,14 +67,13 @@ public class LauncherIcons {
* Returns a bitmap suitable for the all apps view. If the package or the resource do not
* exist, it returns null.
*/
- public static Bitmap createIconBitmap(String packageName, String resourceName,
- Context context) {
+ public static Bitmap createIconBitmap(ShortcutIconResource iconRes, Context context) {
PackageManager packageManager = context.getPackageManager();
// the resource
try {
- Resources resources = packageManager.getResourcesForApplication(packageName);
+ Resources resources = packageManager.getResourcesForApplication(iconRes.packageName);
if (resources != null) {
- final int id = resources.getIdentifier(resourceName, null, null);
+ final int id = resources.getIdentifier(iconRes.resourceName, null, null);
return createIconBitmap(
resources.getDrawableForDensity(id, LauncherAppState.getInstance()
.getInvariantDeviceProfile().fillResIconDpi), context);