diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2013-10-10 01:03:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-10 01:03:22 +0000 |
commit | c14bfe6a287d31c8ee5c7a698a60acfdc7e7e393 (patch) | |
tree | a8c6062035abd17a6ff591becf5ae7e5e01f04d6 | |
parent | b5eb1ffab6db3f311def4f9b28a189a991396537 (diff) | |
parent | d217ed0fa931d2a080a159c24e4012697baf5ae3 (diff) | |
download | android_packages_apps_Snap-c14bfe6a287d31c8ee5c7a698a60acfdc7e7e393.tar.gz android_packages_apps_Snap-c14bfe6a287d31c8ee5c7a698a60acfdc7e7e393.tar.bz2 android_packages_apps_Snap-c14bfe6a287d31c8ee5c7a698a60acfdc7e7e393.zip |
Merge "gcam: Add postcapture for gcam debugging." into gb-ub-photos-carlsbad
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 29 |
2 files changed, 35 insertions, 1 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 35fcf42b3..56789deda 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -115,6 +115,8 @@ public class CameraActivity extends Activity */ public static final int REQ_CODE_DONT_SWITCH_TO_PREVIEW = 142; + public static final int REQ_CODE_GCAM_DEBUG_POSTCAPTURE = 999; + private static final int HIDE_ACTION_BAR = 1; private static final long SHOW_ACTION_BAR_TIMEOUT_MS = 3000; @@ -1474,4 +1476,9 @@ public class CameraActivity extends Activity public CameraOpenErrorCallback getCameraOpenErrorCallback() { return mCameraOpenErrorCallback; } + + // For debugging purposes only. + public CameraModule getCurrentModule() { + return mCurrentModule; + } } 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 */ |