diff options
| -rw-r--r-- | core/api/current.txt | 10 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CameraCharacteristics.java | 16 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CameraMetadata.java | 45 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CaptureRequest.java | 36 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CaptureResult.java | 73 |
5 files changed, 180 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 7eee5f4a7bf6..a8fa70513d50 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -17607,6 +17607,7 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Rational> CONTROL_AE_COMPENSATION_STEP; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AE_LOCK_AVAILABLE; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AF_AVAILABLE_MODES; + field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AUTOFRAMING_AVAILABLE; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_EFFECTS; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.Capability[]> CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_MODES; @@ -17909,6 +17910,12 @@ package android.hardware.camera2 { field public static final int CONTROL_AF_TRIGGER_CANCEL = 2; // 0x2 field public static final int CONTROL_AF_TRIGGER_IDLE = 0; // 0x0 field public static final int CONTROL_AF_TRIGGER_START = 1; // 0x1 + field public static final int CONTROL_AUTOFRAMING_AUTO = 2; // 0x2 + field public static final int CONTROL_AUTOFRAMING_OFF = 0; // 0x0 + field public static final int CONTROL_AUTOFRAMING_ON = 1; // 0x1 + field public static final int CONTROL_AUTOFRAMING_STATE_CONVERGED = 2; // 0x2 + field public static final int CONTROL_AUTOFRAMING_STATE_FRAMING = 1; // 0x1 + field public static final int CONTROL_AUTOFRAMING_STATE_INACTIVE = 0; // 0x0 field public static final int CONTROL_AWB_MODE_AUTO = 1; // 0x1 field public static final int CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6; // 0x6 field public static final int CONTROL_AWB_MODE_DAYLIGHT = 5; // 0x5 @@ -18156,6 +18163,7 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_MODE; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_TRIGGER; + field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AUTOFRAMING; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AWB_LOCK; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AWB_MODE; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS; @@ -18246,6 +18254,8 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_SCENE_CHANGE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_STATE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_TRIGGER; + field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AUTOFRAMING; + field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AUTOFRAMING_STATE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AWB_LOCK; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_MODE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS; diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index d3cb59dbb034..f561278bb25a 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -1310,6 +1310,22 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<int[]>("android.control.availableSettingsOverrides", int[].class); /** + * <p>Whether the camera device supports {@link CaptureRequest#CONTROL_AUTOFRAMING android.control.autoframing}.</p> + * <p>Will be <code>false</code> if auto-framing is not available.</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * <p><b>Limited capability</b> - + * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the + * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> + * + * @see CaptureRequest#CONTROL_AUTOFRAMING + * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL + */ + @PublicKey + @NonNull + public static final Key<Boolean> CONTROL_AUTOFRAMING_AVAILABLE = + new Key<Boolean>("android.control.autoframingAvailable", boolean.class); + + /** * <p>List of edge enhancement modes for {@link CaptureRequest#EDGE_MODE android.edge.mode} that are supported by this camera * device.</p> * <p>Full-capability camera devices must always support OFF; camera devices that support diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 545aa8f2e80d..44f8b1bfda07 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -3244,6 +3244,28 @@ public abstract class CameraMetadata<TKey> { public static final int CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 0x4000; // + // Enumeration values for CaptureRequest#CONTROL_AUTOFRAMING + // + + /** + * <p>Disable autoframing.</p> + * @see CaptureRequest#CONTROL_AUTOFRAMING + */ + public static final int CONTROL_AUTOFRAMING_OFF = 0; + + /** + * <p>Enable autoframing to keep people in the frame's field of view.</p> + * @see CaptureRequest#CONTROL_AUTOFRAMING + */ + public static final int CONTROL_AUTOFRAMING_ON = 1; + + /** + * <p>Automatically select ON or OFF based on the system level preferences.</p> + * @see CaptureRequest#CONTROL_AUTOFRAMING + */ + public static final int CONTROL_AUTOFRAMING_AUTO = 2; + + // // Enumeration values for CaptureRequest#EDGE_MODE // @@ -3997,6 +4019,29 @@ public abstract class CameraMetadata<TKey> { public static final int CONTROL_AF_SCENE_CHANGE_DETECTED = 1; // + // Enumeration values for CaptureResult#CONTROL_AUTOFRAMING_STATE + // + + /** + * <p>Auto-framing is inactive.</p> + * @see CaptureResult#CONTROL_AUTOFRAMING_STATE + */ + public static final int CONTROL_AUTOFRAMING_STATE_INACTIVE = 0; + + /** + * <p>Auto-framing is in process - either zooming in, zooming out or pan is taking place.</p> + * @see CaptureResult#CONTROL_AUTOFRAMING_STATE + */ + public static final int CONTROL_AUTOFRAMING_STATE_FRAMING = 1; + + /** + * <p>Auto-framing has reached a stable state (frame/fov is not being adjusted). The state + * may transition back to FRAMING if the scene changes.</p> + * @see CaptureResult#CONTROL_AUTOFRAMING_STATE + */ + public static final int CONTROL_AUTOFRAMING_STATE_CONVERGED = 2; + + // // Enumeration values for CaptureResult#FLASH_STATE // diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 407ea07838de..8bb6fa5a1a14 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2513,6 +2513,42 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> new Key<Integer>("android.control.settingsOverride", int.class); /** + * <p>Automatic crop, pan and zoom to keep objects in the center of the frame.</p> + * <p>Auto-framing is a special mode provided by the camera device to dynamically crop, zoom + * or pan the camera feed to try to ensure that the people in a scene occupy a reasonable + * portion of the viewport. It is primarily designed to support video calling in + * situations where the user isn't directly in front of the device, especially for + * wide-angle cameras. + * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} and {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in CaptureResult will be used + * to denote the coordinates of the auto-framed region. + * Zoom and video stabilization controls are disabled when auto-framing is enabled. The 3A + * regions must map the screen coordinates into the scaler crop returned from the capture + * result instead of using the active array sensor.</p> + * <p><b>Possible values:</b></p> + * <ul> + * <li>{@link #CONTROL_AUTOFRAMING_OFF OFF}</li> + * <li>{@link #CONTROL_AUTOFRAMING_ON ON}</li> + * <li>{@link #CONTROL_AUTOFRAMING_AUTO AUTO}</li> + * </ul> + * + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * <p><b>Limited capability</b> - + * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the + * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> + * + * @see CaptureRequest#CONTROL_ZOOM_RATIO + * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL + * @see CaptureRequest#SCALER_CROP_REGION + * @see #CONTROL_AUTOFRAMING_OFF + * @see #CONTROL_AUTOFRAMING_ON + * @see #CONTROL_AUTOFRAMING_AUTO + */ + @PublicKey + @NonNull + public static final Key<Integer> CONTROL_AUTOFRAMING = + new Key<Integer>("android.control.autoframing", int.class); + + /** * <p>Operation mode for edge * enhancement.</p> * <p>Edge enhancement improves sharpness and details in the captured image. OFF means diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index c4f0cabc5f78..c5246b52a6cf 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2717,6 +2717,79 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { new Key<Integer>("android.control.settingsOverride", int.class); /** + * <p>Automatic crop, pan and zoom to keep objects in the center of the frame.</p> + * <p>Auto-framing is a special mode provided by the camera device to dynamically crop, zoom + * or pan the camera feed to try to ensure that the people in a scene occupy a reasonable + * portion of the viewport. It is primarily designed to support video calling in + * situations where the user isn't directly in front of the device, especially for + * wide-angle cameras. + * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} and {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in CaptureResult will be used + * to denote the coordinates of the auto-framed region. + * Zoom and video stabilization controls are disabled when auto-framing is enabled. The 3A + * regions must map the screen coordinates into the scaler crop returned from the capture + * result instead of using the active array sensor.</p> + * <p><b>Possible values:</b></p> + * <ul> + * <li>{@link #CONTROL_AUTOFRAMING_OFF OFF}</li> + * <li>{@link #CONTROL_AUTOFRAMING_ON ON}</li> + * <li>{@link #CONTROL_AUTOFRAMING_AUTO AUTO}</li> + * </ul> + * + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * <p><b>Limited capability</b> - + * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the + * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> + * + * @see CaptureRequest#CONTROL_ZOOM_RATIO + * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL + * @see CaptureRequest#SCALER_CROP_REGION + * @see #CONTROL_AUTOFRAMING_OFF + * @see #CONTROL_AUTOFRAMING_ON + * @see #CONTROL_AUTOFRAMING_AUTO + */ + @PublicKey + @NonNull + public static final Key<Integer> CONTROL_AUTOFRAMING = + new Key<Integer>("android.control.autoframing", int.class); + + /** + * <p>Current state of auto-framing.</p> + * <p>When the camera doesn't have auto-framing available (i.e + * <code>{@link CameraCharacteristics#CONTROL_AUTOFRAMING_AVAILABLE android.control.autoframingAvailable}</code> == false) or it is not enabled (i.e + * <code>{@link CaptureRequest#CONTROL_AUTOFRAMING android.control.autoframing}</code> == OFF), the state will always be INACTIVE. + * Other states indicate the current auto-framing state:</p> + * <ul> + * <li>When <code>{@link CaptureRequest#CONTROL_AUTOFRAMING android.control.autoframing}</code> is set to ON, auto-framing will take + * place. While the frame is aligning itself to center the object (doing things like + * zooming in, zooming out or pan), the state will be FRAMING.</li> + * <li>When field of view is not being adjusted anymore and has reached a stable state, the + * state will be CONVERGED.</li> + * </ul> + * <p><b>Possible values:</b></p> + * <ul> + * <li>{@link #CONTROL_AUTOFRAMING_STATE_INACTIVE INACTIVE}</li> + * <li>{@link #CONTROL_AUTOFRAMING_STATE_FRAMING FRAMING}</li> + * <li>{@link #CONTROL_AUTOFRAMING_STATE_CONVERGED CONVERGED}</li> + * </ul> + * + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * <p><b>Limited capability</b> - + * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the + * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> + * + * @see CaptureRequest#CONTROL_AUTOFRAMING + * @see CameraCharacteristics#CONTROL_AUTOFRAMING_AVAILABLE + * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL + * @see #CONTROL_AUTOFRAMING_STATE_INACTIVE + * @see #CONTROL_AUTOFRAMING_STATE_FRAMING + * @see #CONTROL_AUTOFRAMING_STATE_CONVERGED + */ + @PublicKey + @NonNull + public static final Key<Integer> CONTROL_AUTOFRAMING_STATE = + new Key<Integer>("android.control.autoframingState", int.class); + + /** * <p>Operation mode for edge * enhancement.</p> * <p>Edge enhancement improves sharpness and details in the captured image. OFF means |