Fix crash when switching between Apps/Widgets tabs

Bug: 8138894
This commit is contained in:
Michael Jurka
2013-02-07 13:27:06 +01:00
parent b81e22ef4a
commit ee8e99fe3b
4 changed files with 20 additions and 11 deletions

View File

@@ -234,15 +234,14 @@ public class WidgetPreviewLoader {
}
}
public void releaseBitmap(Object o, Bitmap bitmapToFree) {
// enable this code when doDecode doesn't force Bitmaps to become immutable
public void recycleBitmap(Object o, Bitmap bitmapToRecycle) {
String name = getObjectName(o);
synchronized(mLoadedPreviews) {
synchronized(mUnusedBitmaps) {
Bitmap b = mLoadedPreviews.get(name).get();
if (b == bitmapToFree) {
if (b == bitmapToRecycle) {
mLoadedPreviews.remove(name);
if (bitmapToFree.isMutable()) {
if (bitmapToRecycle.isMutable()) {
mUnusedBitmaps.add(new SoftReference<Bitmap>(b));
}
} else {