diff options
-rwxr-xr-x | src/com/android/camera/CameraActivity.java | 15 | ||||
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 15 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index c7f0072ef..3579586e7 100755 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -758,8 +758,8 @@ public class CameraActivity extends Activity } private class UpdateThumbnailTask extends AsyncTask<Void, Void, Bitmap> { - private final byte[] mJpegData; - private final boolean mCheckOrientation; + private byte[] mJpegData; + private boolean mCheckOrientation; public UpdateThumbnailTask(final byte[] jpegData, boolean checkOrientation) { mJpegData = jpegData; @@ -802,6 +802,17 @@ public class CameraActivity extends Activity } else { updateThumbnail(bitmap); } + + mJpegData = null; + } + + @Override + protected void onCancelled(Bitmap bitmap) { + if(bitmap != null) + bitmap.recycle(); + + bitmap = null; + mJpegData = null; } private Bitmap decodeImageCenter(final String path) { diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 92b95e5ec..85722457d 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -357,7 +357,6 @@ public class CaptureModule implements CameraModule, PhotoController, if (uri != null) { mActivity.notifyNewMedia(uri); } - if (mLastJpegData != null) mActivity.updateThumbnail(mLastJpegData); } } }; @@ -1353,7 +1352,6 @@ public class CaptureModule implements CameraModule, PhotoController, long date = (name == null) ? -1 : name.date; byte[] bytes = getJpegData(image); - mLastJpegData = bytes; ExifInterface exif = Exif.getExif(bytes); int orientation = Exif.getOrientation(exif); @@ -1361,6 +1359,12 @@ public class CaptureModule implements CameraModule, PhotoController, mActivity.getMediaSaveService().addImage(bytes, title, date, null, image.getWidth(), image.getHeight(), orientation, null, mOnMediaSavedListener, mContentResolver, "jpeg"); + + if(mLongshotActive) { + mLastJpegData = bytes; + } else { + mActivity.updateThumbnail(bytes); + } image.close(); } } @@ -1395,7 +1399,6 @@ public class CaptureModule implements CameraModule, PhotoController, ByteBuffer buffer = image.getPlanes()[0].getBuffer(); byte[] bytes = new byte[buffer.remaining()]; - mLastJpegData = bytes; buffer.get(bytes); ExifInterface exif = Exif.getExif(bytes); @@ -1404,6 +1407,8 @@ public class CaptureModule implements CameraModule, PhotoController, mActivity.getMediaSaveService().addImage(bytes, title, date, null, image.getWidth(), image.getHeight(), orientation, null, mOnMediaSavedListener, mContentResolver, "jpeg"); + + mActivity.updateThumbnail(bytes); image.close(); } }, mImageAvailableHandler); @@ -1716,6 +1721,7 @@ public class CaptureModule implements CameraModule, PhotoController, mUI.hideSurfaceView(); mFirstPreviewLoaded = false; stopBackgroundThread(); + mLastJpegData = null; } @Override @@ -3490,7 +3496,6 @@ public class CaptureModule implements CameraModule, PhotoController, byte[] bayerBytes = getJpegData(bayerImage); byte[] monoBytes = getJpegData(monoImage); - mLastJpegData = bayerBytes; ExifInterface exif = Exif.getExif(bayerBytes); int orientation = Exif.getOrientation(exif); @@ -3498,6 +3503,8 @@ public class CaptureModule implements CameraModule, PhotoController, null, bayerBytes, monoBytes, width, height, title, date, null, orientation, mOnMediaSavedListener, mContentResolver, "jpeg"); + mActivity.updateThumbnail(bayerBytes); + bayerImage.close(); bayerImage = null; monoImage.close(); |