diff options
author | Chris Wren <cwren@android.com> | 2012-11-01 12:57:36 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2012-11-01 12:57:36 -0400 |
commit | b6c75a5e1a9dfc7753a451e97607510d37264374 (patch) | |
tree | 6fb727ccda1a7478567c1be879721b2c5addab07 /src/com/android/dreams/phototable/PhotoCarousel.java | |
parent | 9ab175f5902c66a266261ccf191bc2d213918eca (diff) | |
download | android_packages_screensavers_PhotoTable-b6c75a5e1a9dfc7753a451e97607510d37264374.tar.gz android_packages_screensavers_PhotoTable-b6c75a5e1a9dfc7753a451e97607510d37264374.tar.bz2 android_packages_screensavers_PhotoTable-b6c75a5e1a9dfc7753a451e97607510d37264374.zip |
don't reuse mOptions across threads.
Bug: 7370134
Change-Id: If6e02c2095f5f70e4dd506e651efbbd5ad47fa07
Diffstat (limited to 'src/com/android/dreams/phototable/PhotoCarousel.java')
-rw-r--r-- | src/com/android/dreams/phototable/PhotoCarousel.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/dreams/phototable/PhotoCarousel.java b/src/com/android/dreams/phototable/PhotoCarousel.java index 495e73c..70ba046 100644 --- a/src/com/android/dreams/phototable/PhotoCarousel.java +++ b/src/com/android/dreams/phototable/PhotoCarousel.java @@ -48,7 +48,6 @@ public class PhotoCarousel extends FrameLayout { private final PhotoSourcePlexor mPhotoSource; private final GestureDetector mGestureDetector; private final View[] mPanel; - private final BitmapFactory.Options mOptions; private final int mFlipDuration; private final int mDropPeriod; private final int mBitmapQueueLimit; @@ -100,8 +99,6 @@ public class PhotoCarousel extends FrameLayout { mDropPeriod = resources.getInteger(R.integer.carousel_drop_period); mBitmapQueueLimit = resources.getInteger(R.integer.num_images_to_preload); mFlipDuration = resources.getInteger(R.integer.flip_duration); - mOptions = new BitmapFactory.Options(); - mOptions.inTempStorage = new byte[32768]; mPhotoSource = new PhotoSourcePlexor(getContext(), getContext().getSharedPreferences(FlipperDreamSettings.PREFS_NAME, 0)); mBitmapStore = new HashMap<View, Bitmap>(); @@ -130,6 +127,13 @@ public class PhotoCarousel extends FrameLayout { } private class PhotoLoadTask extends AsyncTask<Void, Void, Bitmap> { + private final BitmapFactory.Options mOptions; + + public PhotoLoadTask () { + mOptions = new BitmapFactory.Options(); + mOptions.inTempStorage = new byte[32768]; + } + @Override public Bitmap doInBackground(Void... unused) { Bitmap decodedPhoto; @@ -180,8 +184,8 @@ public class PhotoCarousel extends FrameLayout { if (photo != null) { ImageView destination = getBackface(); Bitmap old = mBitmapStore.get(destination); - int width = mOptions.outWidth; - int height = mOptions.outHeight; + int width = photo.getWidth(); + int height = photo.getHeight(); int orientation = (width > height ? LANDSCAPE : PORTRAIT); destination.setImageBitmap(photo); |