diff options
author | Sol Boucher <solb@google.com> | 2014-08-28 19:30:49 -0700 |
---|---|---|
committer | Sol Boucher <solb@google.com> | 2014-08-29 11:46:52 -0700 |
commit | 2569329d6cff25bfe9941df539df14a0aeb4c4f4 (patch) | |
tree | 451b8993bb048b78ffa1606ac70c9c0c932e24b0 /camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java | |
parent | 47a01cf05c1e22e76bdf3182461dcfeb71b960bb (diff) | |
download | android_frameworks_ex-2569329d6cff25bfe9941df539df14a0aeb4c4f4.tar.gz android_frameworks_ex-2569329d6cff25bfe9941df539df14a0aeb4c4f4.tar.bz2 android_frameworks_ex-2569329d6cff25bfe9941df539df14a0aeb4c4f4.zip |
camera2-portability: Touch-to-focus accounting for effective crop
This fixes the calculation of API 2 focus and metering rectangles to account for
the effective crop region (after the framework has performed automatic cropping
to match the requested output aspect ratio). It also guards against and prints
warnings when changing the resolution after having configured the session and
surfaces; before, this was merely a silent no-op.
Bug: 17187095
Change-Id: I3243bea24d6936d1bba5d556b3846d172ad0defe
Diffstat (limited to 'camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java')
-rw-r--r-- | camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java b/camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java index df94a41..b624b47 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/CameraAgent.java @@ -436,8 +436,24 @@ public abstract class CameraAgent { /** * Sets the {@link android.graphics.SurfaceTexture} for preview. * + * <p>Note that, once this operation has been performed, it is no longer + * possible to change the preview or photo sizes in the + * {@link CameraSettings} instance for this camera, and the mutators for + * these fields are allowed to ignore all further invocations until the + * preview is stopped with {@link #stopPreview}.</p> + * * @param surfaceTexture The {@link SurfaceTexture} for preview. - */ + * + * @see CameraSettings#setPhotoSize + * @see CameraSettings#setPreviewSize + */ + // XXX: Despite the above documentation about locking the sizes, the API + // 1 implementation doesn't currently enforce this at all, although the + // Camera class warns that preview sizes shouldn't be changed while a + // preview is running. Furthermore, the API 2 implementation doesn't yet + // unlock the sizes when stopPreview() is invoked (see related FIXME on + // the STOP_PREVIEW case in its handler; in the meantime, changing API 2 + // sizes would require closing and reopening the camera. public void setPreviewTexture(final SurfaceTexture surfaceTexture) { getDispatchThread().runJob(new Runnable() { @Override @@ -452,7 +468,15 @@ public abstract class CameraAgent { * Blocks until a {@link android.graphics.SurfaceTexture} has been set * for preview. * + * <p>Note that, once this operation has been performed, it is no longer + * possible to change the preview or photo sizes in the + * {@link CameraSettings} instance for this camera, and the mutators for + * these fields are allowed to ignore all further invocations.</p> + * * @param surfaceTexture The {@link SurfaceTexture} for preview. + * + * @see CameraSettings#setPhotoSize + * @see CameraSettings#setPreviewSize */ public void setPreviewTextureSync(final SurfaceTexture surfaceTexture) { final WaitDoneBundle bundle = new WaitDoneBundle(); |