summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkayiz <kaiyiz@codeaurora.org>2014-03-04 15:05:22 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-12-12 07:52:09 -0800
commitfc2a0a61de5bc6d7ba3a2ae3de96a9f2bb178390 (patch)
treed871a3eb97f26f01c84fbe9a97ff5ce4e5f17013 /src
parent946cc8ee895d01774c2a75239e5892e9593419d7 (diff)
downloadandroid_packages_apps_Gallery2-fc2a0a61de5bc6d7ba3a2ae3de96a9f2bb178390.tar.gz
android_packages_apps_Gallery2-fc2a0a61de5bc6d7ba3a2ae3de96a9f2bb178390.tar.bz2
android_packages_apps_Gallery2-fc2a0a61de5bc6d7ba3a2ae3de96a9f2bb178390.zip
Gallery2: Fix cropped picture cannot be saved.
When click the saveButton to save the cropped picture, We found the source picture uri and the cropped picture uri are the same,which cause the cropped picture can not be saved. Closed file Stream of mInStream before re-open it for the same file. CRs-Fixed: 622666 Change-Id: Ifcaa39ea76c141021259fad891411c59f7587903
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/crop/CropActivity.java23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/filtershow/crop/CropActivity.java b/src/com/android/gallery3d/filtershow/crop/CropActivity.java
index 387803740..94c859333 100644
--- a/src/com/android/gallery3d/filtershow/crop/CropActivity.java
+++ b/src/com/android/gallery3d/filtershow/crop/CropActivity.java
@@ -400,16 +400,8 @@ public class CropActivity extends Activity {
mOutputX = outputX;
mOutputY = outputY;
- if ((flags & DO_EXTRA_OUTPUT) != 0) {
- if (mOutUri == null) {
- Log.w(LOGTAG, "cannot write file, no output URI given");
- } else {
- try {
- mOutStream = getContentResolver().openOutputStream(mOutUri);
- } catch (FileNotFoundException e) {
- Log.w(LOGTAG, "cannot write file: " + mOutUri.toString(), e);
- }
- }
+ if ((flags & DO_EXTRA_OUTPUT) != 0 && mOutUri == null) {
+ Log.w(LOGTAG, "cannot write file, no output URI given");
}
if ((flags & (DO_EXTRA_OUTPUT | DO_SET_WALLPAPER)) != 0) {
@@ -542,7 +534,14 @@ public class CropActivity extends Activity {
// Get output compression format
CompressFormat cf =
convertExtensionToCompressFormat(getFileExtension(mOutputFormat));
-
+ Utils.closeSilently(mInStream);
+ if (mOutUri != null) {
+ try {
+ mOutStream = getContentResolver().openOutputStream(mOutUri);
+ } catch (FileNotFoundException e) {
+ Log.w(LOGTAG, "cannot write file: " + mOutUri.toString(), e);
+ }
+ }
// If we only need to output to a URI, compress straight to file
if (mFlags == DO_EXTRA_OUTPUT) {
if (mOutStream == null
@@ -604,7 +603,7 @@ public class CropActivity extends Activity {
@Override
protected void onPostExecute(Boolean result) {
Utils.closeSilently(mOutStream);
- Utils.closeSilently(mInStream);
+ // Utils.closeSilently(mInStream);
doneBitmapIO(result.booleanValue(), mResultIntent);
}