diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-02-18 16:46:50 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-02-26 19:08:44 +0000 |
commit | 4fbc3828c5ae1e8c5789ede974447fa365f3c5a1 (patch) | |
tree | 9e570b85d5550537b17c85fd1d579fcc43b6136f /src/com/android/launcher3/Utilities.java | |
parent | ed46c093cf1f34a2056846ac826b19fa2335ec18 (diff) | |
download | android_packages_apps_Trebuchet-4fbc3828c5ae1e8c5789ede974447fa365f3c5a1.tar.gz android_packages_apps_Trebuchet-4fbc3828c5ae1e8c5789ede974447fa365f3c5a1.tar.bz2 android_packages_apps_Trebuchet-4fbc3828c5ae1e8c5789ede974447fa365f3c5a1.zip |
Updating IconCache to maintain a persistent of icons
> IconDB maintains a DB of icons keyed on ComponentName + User
> During loader, icons & labels are loaded first from the DB, and
if the entry doesn't exist, loaded using packageManager
> After the loader completes, IconDB updates any entry which might have
changed, while the launcher was dead.
Change-Id: I7a6021cb6d1ca1e66fa5a0bdd21e1543e0cf66fc
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 1a9b9a16c..497b43874 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -31,7 +31,9 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.res.Resources; +import android.database.Cursor; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; @@ -112,6 +114,15 @@ public final class Utilities { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; } + static Bitmap createIconBitmap(Cursor c, int iconIndex, Context context) { + byte[] data = c.getBlob(iconIndex); + try { + return createIconBitmap(BitmapFactory.decodeByteArray(data, 0, data.length), context); + } catch (Exception e) { + return null; + } + } + /** * Returns a bitmap suitable for the all apps view. If the package or the resource do not * exist, it returns null. |