diff --git a/core/api/current.txt b/core/api/current.txt index 07ced0e63eeb5..1c9b6c3a5fe51 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -17651,6 +17651,7 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_COMPENSATION_STEP; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_LOCK_AVAILABLE; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AF_AVAILABLE_MODES; + field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AUTOFRAMING_AVAILABLE; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AVAILABLE_EFFECTS; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AVAILABLE_MODES; @@ -17955,6 +17956,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 @@ -18202,6 +18209,7 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AF_MODE; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AF_REGIONS; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AF_TRIGGER; + field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AUTOFRAMING; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AWB_LOCK; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AWB_MODE; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key CONTROL_AWB_REGIONS; @@ -18292,6 +18300,8 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AF_SCENE_CHANGE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AF_STATE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AF_TRIGGER; + field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AUTOFRAMING; + field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AUTOFRAMING_STATE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AWB_LOCK; field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AWB_MODE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key CONTROL_AWB_REGIONS; diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index d3cb59dbb034c..f561278bb25a5 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -1309,6 +1309,22 @@ public final class CameraCharacteristics extends CameraMetadata CONTROL_AVAILABLE_SETTINGS_OVERRIDES = new Key("android.control.availableSettingsOverrides", int[].class); + /** + *

Whether the camera device supports {@link CaptureRequest#CONTROL_AUTOFRAMING android.control.autoframing}.

+ *

Will be false if auto-framing is not available.

+ *

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

+ *

Limited capability - + * 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

+ * + * @see CaptureRequest#CONTROL_AUTOFRAMING + * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL + */ + @PublicKey + @NonNull + public static final Key CONTROL_AUTOFRAMING_AVAILABLE = + new Key("android.control.autoframingAvailable", boolean.class); + /** *

List of edge enhancement modes for {@link CaptureRequest#EDGE_MODE android.edge.mode} that are supported by this camera * device.

diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 545aa8f2e80dd..44f8b1bfda07b 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -3243,6 +3243,28 @@ public abstract class CameraMetadata { */ public static final int CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 0x4000; + // + // Enumeration values for CaptureRequest#CONTROL_AUTOFRAMING + // + + /** + *

Disable autoframing.

+ * @see CaptureRequest#CONTROL_AUTOFRAMING + */ + public static final int CONTROL_AUTOFRAMING_OFF = 0; + + /** + *

Enable autoframing to keep people in the frame's field of view.

+ * @see CaptureRequest#CONTROL_AUTOFRAMING + */ + public static final int CONTROL_AUTOFRAMING_ON = 1; + + /** + *

Automatically select ON or OFF based on the system level preferences.

+ * @see CaptureRequest#CONTROL_AUTOFRAMING + */ + public static final int CONTROL_AUTOFRAMING_AUTO = 2; + // // Enumeration values for CaptureRequest#EDGE_MODE // @@ -3996,6 +4018,29 @@ public abstract class CameraMetadata { */ public static final int CONTROL_AF_SCENE_CHANGE_DETECTED = 1; + // + // Enumeration values for CaptureResult#CONTROL_AUTOFRAMING_STATE + // + + /** + *

Auto-framing is inactive.

+ * @see CaptureResult#CONTROL_AUTOFRAMING_STATE + */ + public static final int CONTROL_AUTOFRAMING_STATE_INACTIVE = 0; + + /** + *

Auto-framing is in process - either zooming in, zooming out or pan is taking place.

+ * @see CaptureResult#CONTROL_AUTOFRAMING_STATE + */ + public static final int CONTROL_AUTOFRAMING_STATE_FRAMING = 1; + + /** + *

Auto-framing has reached a stable state (frame/fov is not being adjusted). The state + * may transition back to FRAMING if the scene changes.

+ * @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 407ea07838de2..8bb6fa5a1a14f 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2512,6 +2512,42 @@ public final class CaptureRequest extends CameraMetadata> public static final Key CONTROL_SETTINGS_OVERRIDE = new Key("android.control.settingsOverride", int.class); + /** + *

Automatic crop, pan and zoom to keep objects in the center of the frame.

+ *

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.

+ *

Possible values:

+ *
    + *
  • {@link #CONTROL_AUTOFRAMING_OFF OFF}
  • + *
  • {@link #CONTROL_AUTOFRAMING_ON ON}
  • + *
  • {@link #CONTROL_AUTOFRAMING_AUTO AUTO}
  • + *
+ * + *

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

+ *

Limited capability - + * 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

+ * + * @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 CONTROL_AUTOFRAMING = + new Key("android.control.autoframing", int.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 c4f0cabc5f788..c5246b52a6cfd 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2716,6 +2716,79 @@ public class CaptureResult extends CameraMetadata> { public static final Key CONTROL_SETTINGS_OVERRIDE = new Key("android.control.settingsOverride", int.class); + /** + *

Automatic crop, pan and zoom to keep objects in the center of the frame.

+ *

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.

+ *

Possible values:

+ *
    + *
  • {@link #CONTROL_AUTOFRAMING_OFF OFF}
  • + *
  • {@link #CONTROL_AUTOFRAMING_ON ON}
  • + *
  • {@link #CONTROL_AUTOFRAMING_AUTO AUTO}
  • + *
+ * + *

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

+ *

Limited capability - + * 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

+ * + * @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 CONTROL_AUTOFRAMING = + new Key("android.control.autoframing", int.class); + + /** + *

Current state of auto-framing.

+ *

When the camera doesn't have auto-framing available (i.e + * {@link CameraCharacteristics#CONTROL_AUTOFRAMING_AVAILABLE android.control.autoframingAvailable} == false) or it is not enabled (i.e + * {@link CaptureRequest#CONTROL_AUTOFRAMING android.control.autoframing} == OFF), the state will always be INACTIVE. + * Other states indicate the current auto-framing state:

+ *
    + *
  • When {@link CaptureRequest#CONTROL_AUTOFRAMING android.control.autoframing} 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.
  • + *
  • When field of view is not being adjusted anymore and has reached a stable state, the + * state will be CONVERGED.
  • + *
+ *

Possible values:

+ *
    + *
  • {@link #CONTROL_AUTOFRAMING_STATE_INACTIVE INACTIVE}
  • + *
  • {@link #CONTROL_AUTOFRAMING_STATE_FRAMING FRAMING}
  • + *
  • {@link #CONTROL_AUTOFRAMING_STATE_CONVERGED CONVERGED}
  • + *
+ * + *

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

+ *

Limited capability - + * 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

+ * + * @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 CONTROL_AUTOFRAMING_STATE = + new Key("android.control.autoframingState", int.class); + /** *

Operation mode for edge * enhancement.