From 4ef1d738b796d9b6af448d9bfc46e262a97eafcd Mon Sep 17 00:00:00 2001 From: Ruben Brunk Date: Mon, 11 Mar 2013 12:00:06 -0700 Subject: Clear Gallery's bitmap pool before starting photoeditor. Change-Id: Iaa1f559db12ba22e53673b2e9fe2c3fbabf33514 --- .../android/gallery3d/filtershow/FilterShowActivity.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 1c7c0642a..10650b9e6 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -86,6 +86,7 @@ import com.android.gallery3d.filtershow.ui.FilterIconButton; import com.android.gallery3d.filtershow.ui.FramedTextButton; import com.android.gallery3d.filtershow.ui.Spline; import com.android.gallery3d.util.GalleryUtils; +import com.android.photos.data.GalleryBitmapPool; import java.io.File; import java.io.IOException; @@ -141,6 +142,8 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + clearGalleryBitmapPool(); + setupMasterImage(); setDefaultValues(); fillEditors(); @@ -512,6 +515,17 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, } + private void clearGalleryBitmapPool() { + (new AsyncTask() { + @Override + protected Void doInBackground(Void... params) { + // Free memory held in Gallery's Bitmap pool. May be O(n) for n bitmaps. + GalleryBitmapPool.getInstance().clear(); + return null; + } + }).execute(); + } + private void fillButtonIcons() { Bitmap bmap = mImageLoader.getOriginalBitmapSmall(); if (bmap != null && bmap.getWidth() > 0 && bmap.getHeight() > 0) { -- cgit v1.2.3