Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d91cb407 authored by Bharatt Kukreja's avatar Bharatt Kukreja Committed by Android (Google) Code Review
Browse files

Merge "Camera: Add autoframing API"

parents cfc6ebbd d0793c50
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -17651,6 +17651,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;
@@ -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<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;
@@ -18292,6 +18300,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;
+16 −0
Original line number Diff line number Diff line
@@ -1309,6 +1309,22 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
    public static final Key<int[]> CONTROL_AVAILABLE_SETTINGS_OVERRIDES =
            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>
+45 −0
Original line number Diff line number Diff line
@@ -3243,6 +3243,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
    //
@@ -3996,6 +4018,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
    //
+36 −0
Original line number Diff line number Diff line
@@ -2512,6 +2512,42 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    public static final Key<Integer> CONTROL_SETTINGS_OVERRIDE =
            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>
+73 −0
Original line number Diff line number Diff line
@@ -2716,6 +2716,79 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
    public static final Key<Integer> CONTROL_SETTINGS_OVERRIDE =
            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>