diff options
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 3c495dbfe..ff28700c1 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -158,6 +158,8 @@ public class PhotoModule private String mCropValue; private Uri mSaveUri; + private Uri mDebugUri; + // We use a queue to generated names of the images to be used later // when the image is ready to be saved. private NamedImages mNamedImages; @@ -704,7 +706,11 @@ public class PhotoModule ExifInterface exif = Exif.getExif(jpegData); int orientation = Exif.getOrientation(exif); - if (!mIsImageCaptureIntent) { + + if (mDebugUri != null) { + // If using a debug uri, save jpeg there + saveToDebugUri(jpegData); + }else if (!mIsImageCaptureIntent) { // Calculate the width and the height of the jpeg. Size s = mParameters.getPictureSize(); int width, height; @@ -1925,6 +1931,27 @@ public class PhotoModule mUI.onPreviewFocusChanged(previewFocused); } + // For debugging only. + public void setDebugUri(Uri uri) { + mDebugUri = uri; + } + + // For debugging only. + private void saveToDebugUri(byte[] data) { + if (mDebugUri != null) { + OutputStream outputStream = null; + try { + outputStream = mContentResolver.openOutputStream(mDebugUri); + outputStream.write(data); + outputStream.close(); + } catch (IOException e) { + Log.e(TAG, "Exception while writing debug jpeg file", e); + } finally { + CameraUtil.closeSilently(outputStream); + } + } + } + /* Below is no longer needed, except to get rid of compile error * TODO: Remove these */ |