From dc921d86ad3af557dbf41c9f1f002426c6591d73 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Mon, 30 Nov 2020 20:17:52 -0800 Subject: [PATCH] Camera: Document behavior when cropRegion and zoomRation conflict In case cropRegion == windowboxing and zoomRatio != 1.0f, specify the camera framework behavior of overriding cropRegion. Test: Build Bug: 172873869 Change-Id: Ic7713260cdd5f51e422be330534dd1e5648ba2fc --- .../java/android/hardware/camera2/CameraCharacteristics.java | 4 +++- core/java/android/hardware/camera2/CaptureRequest.java | 5 ++++- core/java/android/hardware/camera2/CaptureResult.java | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index dc56963ffd8c8..d0aa9c3cd8dee 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -2771,7 +2771,9 @@ public final class CameraCharacteristics extends CameraMetadata * *
  • Setting {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} to values different than 1.0 and - * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be windowboxing at the same time is undefined behavior.
  • + * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be windowboxing at the same time are not supported. In this + * case, the camera framework will override the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be the active + * array. * *

    LEGACY capability devices will only support CENTER_ONLY cropping.

    *

    Possible values: diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 4bc9151fed833..3585168bd6270 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2242,7 +2242,10 @@ public final class CaptureRequest extends CameraMetadata> * explicitly set {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, its value defaults to 1.0.

    *

    One limitation of controlling zoom using zoomRatio is that the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} * must only be used for letterboxing or pillarboxing of the sensor active array, and no - * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0.

    + * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0. If + * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is not 1.0, and {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is set to be + * windowboxing, the camera framework will override the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be + * the active array.

    *

    Range of valid values:
    * {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}

    *

    Optional - The value for this key may be {@code null} on some devices.

    diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 5c10e96fd2ce0..af3a63c0c614a 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2472,7 +2472,10 @@ public class CaptureResult extends CameraMetadata> { * explicitly set {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, its value defaults to 1.0.

    *

    One limitation of controlling zoom using zoomRatio is that the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} * must only be used for letterboxing or pillarboxing of the sensor active array, and no - * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0.

    + * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0. If + * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is not 1.0, and {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} is set to be + * windowboxing, the camera framework will override the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to be + * the active array.

    *

    Range of valid values:
    * {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}

    *

    Optional - The value for this key may be {@code null} on some devices.