diff options
author | Sol Boucher <solb@google.com> | 2014-07-22 18:39:32 -0700 |
---|---|---|
committer | Sol Boucher <solb@google.com> | 2014-08-07 15:02:05 -0700 |
commit | de48004068f8c16f9a56c60b0ed2485a67687b4b (patch) | |
tree | cc584bbc1756d0f5f00367f39565288679728809 /camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java | |
parent | d4e5286bb4145e0371b783158fc8411565429c9b (diff) | |
download | android_frameworks_ex-de48004068f8c16f9a56c60b0ed2485a67687b4b.tar.gz android_frameworks_ex-de48004068f8c16f9a56c60b0ed2485a67687b4b.tar.bz2 android_frameworks_ex-de48004068f8c16f9a56c60b0ed2485a67687b4b.zip |
camera2-portability: Support photo capture using camera2 API
This implements JPEG capture, including an autoexposure precapture sequence.
There are many changes to AndroidCamera2Capabilities and AndroidCamera2Settings
to support the representation of modes (e.g. flash modes) whose flags do not
map trivially between the API implementations. Part of this work is the
conversion of AndroidCamera2AgentImpl to use and store a
Camera2RequestSettingsSet instead of a bare API 2 CaptureRequest.Builder.
Change-Id: I03f9f98c954a7b0c140ac8d80161878c92ef65d2
Diffstat (limited to 'camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java')
-rw-r--r-- | camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java index 9bbbb7a..95f0320 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraAgentImpl.java @@ -175,7 +175,7 @@ class AndroidCameraAgentImpl extends CameraAgent { return mFirstFrontCameraId; } - private static class AndroidCharacteristics implements Characteristics { + private static class AndroidCharacteristics extends Characteristics { private Camera.CameraInfo mCameraInfo; AndroidCharacteristics(Camera.CameraInfo cameraInfo) { @@ -437,7 +437,14 @@ class AndroidCameraAgentImpl extends CameraAgent { } case CameraActions.SET_DISPLAY_ORIENTATION: { - mCamera.setDisplayOrientation(msg.arg1); + // Update preview orientation + mCamera.setDisplayOrientation( + mCharacteristics.getPreviewOrientation(msg.arg1)); + // Only set the JPEG capture orientation if requested to do so; otherwise, + // capture in the sensor's physical orientation + mParamsToSet.setRotation( + msg.arg2 > 0 ? mCharacteristics.getJpegOrientation(msg.arg1) : 0); + mCamera.setParameters(mParamsToSet); break; } @@ -566,7 +573,6 @@ class AndroidCameraAgentImpl extends CameraAgent { // Should use settings.getCurrentZoomRatio() instead here. mParamsToSet.setZoom(settings.getCurrentZoomIndex()); } - mParamsToSet.setRotation((int) settings.getCurrentPhotoRotationDegrees()); mParamsToSet.setExposureCompensation(settings.getExposureCompensationIndex()); if (mCapabilities.supports(CameraCapabilities.Feature.AUTO_EXPOSURE_LOCK)) { mParamsToSet.setAutoExposureLock(settings.isAutoExposureLocked()); |