From e449171fc15aba2928a6e267a7214edbb470e812 Mon Sep 17 00:00:00 2001 From: Chien-Yu Chen Date: Wed, 11 Jan 2017 11:14:06 -0800 Subject: [PATCH] camera: Add enableZsl key Add enableZsl key so the apps can choose to allow or disallow out of order frame contents and metadata like timestamp. Test: Camera CTS tests on Marlin Bug: 30983997 Change-Id: I009c53a2cc63ac74a4467c26aa8de018a3e6b7aa --- api/current.txt | 2 ++ api/system-current.txt | 2 ++ api/test-current.txt | 2 ++ .../hardware/camera2/CaptureRequest.java | 28 +++++++++++++++++++ .../hardware/camera2/CaptureResult.java | 28 +++++++++++++++++++ 5 files changed, 62 insertions(+) diff --git a/api/current.txt b/api/current.txt index 25dd3d820db1e..1df21dc2d7a24 100644 --- a/api/current.txt +++ b/api/current.txt @@ -14748,6 +14748,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AWB_REGIONS; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_CAPTURE_INTENT; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_EFFECT_MODE; + field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_ENABLE_ZSL; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_MODE; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_POST_RAW_SENSITIVITY_BOOST; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_SCENE_MODE; @@ -14827,6 +14828,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key CONTROL_AWB_STATE; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_CAPTURE_INTENT; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_EFFECT_MODE; + field public static final android.hardware.camera2.CaptureResult.Key CONTROL_ENABLE_ZSL; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_MODE; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_POST_RAW_SENSITIVITY_BOOST; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_SCENE_MODE; diff --git a/api/system-current.txt b/api/system-current.txt index 6862762e385b1..8170628235b53 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -15278,6 +15278,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AWB_REGIONS; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_CAPTURE_INTENT; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_EFFECT_MODE; + field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_ENABLE_ZSL; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_MODE; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_POST_RAW_SENSITIVITY_BOOST; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_SCENE_MODE; @@ -15357,6 +15358,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key CONTROL_AWB_STATE; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_CAPTURE_INTENT; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_EFFECT_MODE; + field public static final android.hardware.camera2.CaptureResult.Key CONTROL_ENABLE_ZSL; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_MODE; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_POST_RAW_SENSITIVITY_BOOST; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_SCENE_MODE; diff --git a/api/test-current.txt b/api/test-current.txt index 0839043c2ab4c..dfaac28c68080 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -14780,6 +14780,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AWB_REGIONS; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_CAPTURE_INTENT; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_EFFECT_MODE; + field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_ENABLE_ZSL; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_MODE; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_POST_RAW_SENSITIVITY_BOOST; field public static final android.hardware.camera2.CaptureRequest.Key CONTROL_SCENE_MODE; @@ -14859,6 +14860,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key CONTROL_AWB_STATE; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_CAPTURE_INTENT; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_EFFECT_MODE; + field public static final android.hardware.camera2.CaptureResult.Key CONTROL_ENABLE_ZSL; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_MODE; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_POST_RAW_SENSITIVITY_BOOST; field public static final android.hardware.camera2.CaptureResult.Key CONTROL_SCENE_MODE; diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 98a89048ae121..12b46c1bf6939 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -1624,6 +1624,34 @@ public final class CaptureRequest extends CameraMetadata> public static final Key CONTROL_POST_RAW_SENSITIVITY_BOOST = new Key("android.control.postRawSensitivityBoost", int.class); + /** + *

Allow camera device to enable zero-shutter-lag mode for requests with + * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.

+ *

If enableZsl is true, the camera device may enable zero-shutter-lag mode for requests with + * STILL_CAPTURE capture intent. The camera device may use images captured in the past to + * produce output images for a zero-shutter-lag request. The result metadata including the + * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images. + * Therefore, the contents of the output images and the result metadata may be out of order + * compared to previous regular requests. enableZsl does not affect requests with other + * capture intents.

+ *

For example, when requests are submitted in the following order: + * Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW + * Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE

+ *

The output images for request B may have contents captured before the output images for + * request A, and the result metadata for request B may be older than the result metadata for + * request A.

+ *

Note that when enableZsl is true, it is not guaranteed to get output images captured in the + * past for requests with STILL_CAPTURE capture intent.

+ *

The value of enableZsl in capture templates is always false if present.

+ *

Optional - This value may be {@code null} on some devices.

+ * + * @see CaptureRequest#CONTROL_CAPTURE_INTENT + * @see CaptureResult#SENSOR_TIMESTAMP + */ + @PublicKey + public static final Key CONTROL_ENABLE_ZSL = + new Key("android.control.enableZsl", boolean.class); + /** *

Operation mode for edge * enhancement.

diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 23f4b9e6ce067..3f8b57a3498f3 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2131,6 +2131,34 @@ public class CaptureResult extends CameraMetadata> { public static final Key CONTROL_POST_RAW_SENSITIVITY_BOOST = new Key("android.control.postRawSensitivityBoost", int.class); + /** + *

Allow camera device to enable zero-shutter-lag mode for requests with + * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.

+ *

If enableZsl is true, the camera device may enable zero-shutter-lag mode for requests with + * STILL_CAPTURE capture intent. The camera device may use images captured in the past to + * produce output images for a zero-shutter-lag request. The result metadata including the + * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images. + * Therefore, the contents of the output images and the result metadata may be out of order + * compared to previous regular requests. enableZsl does not affect requests with other + * capture intents.

+ *

For example, when requests are submitted in the following order: + * Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW + * Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE

+ *

The output images for request B may have contents captured before the output images for + * request A, and the result metadata for request B may be older than the result metadata for + * request A.

+ *

Note that when enableZsl is true, it is not guaranteed to get output images captured in the + * past for requests with STILL_CAPTURE capture intent.

+ *

The value of enableZsl in capture templates is always false if present.

+ *

Optional - This value may be {@code null} on some devices.

+ * + * @see CaptureRequest#CONTROL_CAPTURE_INTENT + * @see CaptureResult#SENSOR_TIMESTAMP + */ + @PublicKey + public static final Key CONTROL_ENABLE_ZSL = + new Key("android.control.enableZsl", boolean.class); + /** *

Operation mode for edge * enhancement.