summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSuman Mukherjee <sumam@codeaurora.org>2014-01-07 09:30:00 +0530
committerSteve Kondik <steve@cyngn.com>2015-03-28 14:58:54 -0700
commit314380d8cf039621a0d0f6adaf324e2de80aaad4 (patch)
treecd59fa126bf36bc802c0df90a77cd5bdbfcacf95 /src
parentc60e0edb2b413c0fb0bb11d7b697d54fb17141d8 (diff)
downloadandroid_packages_apps_Gallery2-314380d8cf039621a0d0f6adaf324e2de80aaad4.zip
android_packages_apps_Gallery2-314380d8cf039621a0d0f6adaf324e2de80aaad4.tar.gz
android_packages_apps_Gallery2-314380d8cf039621a0d0f6adaf324e2de80aaad4.tar.bz2
Camera: Ensure background edition complete on back Key
Block back key event till the image will get displayed while user pressed edit option/icon. This'll allow the background process to cleanup memory. Added null check and bitmap recycle to avoid crash. Change-Id: Ied1c1f3ecf07a352743908135a5b7976373a58a3 CRs-Fixed: 587402
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java8
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java3
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/UpdatePreviewTask.java3
3 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index dcd0c92..fe383ce 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -199,6 +199,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
private DialogInterface mCurrentDialog = null;
private PopupMenu mCurrentMenu = null;
private boolean mLoadingVisible = true;
+ private boolean mLoadingComplete = false;
public ProcessingService getProcessingService() {
return mBoundService;
@@ -287,6 +288,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
doBindService();
getWindow().setBackgroundDrawable(new ColorDrawable(Color.GRAY));
setContentView(R.layout.filtershow_splashscreen);
+ mLoadingComplete = false;
}
public boolean isShowingImageStatePanel() {
@@ -886,6 +888,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
MasterImage.getImage().warnListeners();
loadActions();
+ mLoadingComplete = false;
if (mOriginalPreset != null) {
MasterImage.getImage().setLoadedPreset(mOriginalPreset);
@@ -1190,6 +1193,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
public void enableSave(boolean enable) {
+ mLoadingComplete = true;
if (mSaveButton != null) {
mSaveButton.setEnabled(enable);
}
@@ -1357,6 +1361,10 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
Fragment currentPanel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
if (currentPanel instanceof MainPanel) {
if (!mImageShow.hasModifications()) {
+ if (!mLoadingComplete) {
+ Log.v(LOGTAG,"Background processing is ON, rejecting back key event");
+ return;
+ }
done();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
diff --git a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
index e8c9b0f..06ce9e9 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
@@ -176,6 +176,9 @@ public class CachingPipeline implements PipelineInterface {
}
public void setOriginal(Bitmap bitmap) {
+ if (mOriginalBitmap != null) {
+ mOriginalBitmap.recycle();
+ }
mOriginalBitmap = bitmap;
Log.v(LOGTAG,"setOriginal, size " + bitmap.getWidth() + " x " + bitmap.getHeight());
ImagePreset preset = MasterImage.getImage().getPreset();
diff --git a/src/com/android/gallery3d/filtershow/pipeline/UpdatePreviewTask.java b/src/com/android/gallery3d/filtershow/pipeline/UpdatePreviewTask.java
index 61ee8eb..5375c25 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/UpdatePreviewTask.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/UpdatePreviewTask.java
@@ -57,7 +57,8 @@ public class UpdatePreviewTask extends ProcessingTask {
SharedBuffer buffer = MasterImage.getImage().getPreviewBuffer();
SharedPreset preset = MasterImage.getImage().getPreviewPreset();
ImagePreset renderingPreset = preset.dequeuePreset();
- if (renderingPreset != null) {
+ if ( (buffer != null) && (renderingPreset != null) &&
+ (buffer.getProducer() != null)) {
mPreviewPipeline.compute(buffer, renderingPreset, 0);
// set the preset we used in the buffer for later inspection UI-side
buffer.getProducer().setPreset(renderingPreset);