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

Commit b3c13af6 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Android (Google) Code Review
Browse files

Merge "Camera: Add CONTROL_ZOOM_METHOD control" into main

parents dad192db ccab87af
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -19783,6 +19783,8 @@ package android.hardware.camera2 {
    field public static final int CONTROL_VIDEO_STABILIZATION_MODE_OFF = 0; // 0x0
    field public static final int CONTROL_VIDEO_STABILIZATION_MODE_ON = 1; // 0x1
    field public static final int CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION = 2; // 0x2
    field @FlaggedApi("com.android.internal.camera.flags.zoom_method") public static final int CONTROL_ZOOM_METHOD_AUTO = 0; // 0x0
    field @FlaggedApi("com.android.internal.camera.flags.zoom_method") public static final int CONTROL_ZOOM_METHOD_ZOOM_RATIO = 1; // 0x1
    field public static final int DISTORTION_CORRECTION_MODE_FAST = 1; // 0x1
    field public static final int DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
    field public static final int DISTORTION_CORRECTION_MODE_OFF = 0; // 0x0
@@ -19990,6 +19992,7 @@ package android.hardware.camera2 {
    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_SCENE_MODE;
    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_SETTINGS_OVERRIDE;
    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
    field @FlaggedApi("com.android.internal.camera.flags.zoom_method") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_ZOOM_METHOD;
    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> CONTROL_ZOOM_RATIO;
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.CaptureRequest> CREATOR;
    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
@@ -20088,6 +20091,7 @@ package android.hardware.camera2 {
    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_SCENE_MODE;
    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_SETTINGS_OVERRIDE;
    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
    field @FlaggedApi("com.android.internal.camera.flags.zoom_method") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_ZOOM_METHOD;
    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> CONTROL_ZOOM_RATIO;
    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> EDGE_MODE;
+26 −0
Original line number Diff line number Diff line
@@ -3370,6 +3370,32 @@ public abstract class CameraMetadata<TKey> {
     */
    public static final int CONTROL_AUTOFRAMING_AUTO = 2;

    //
    // Enumeration values for CaptureRequest#CONTROL_ZOOM_METHOD
    //

    /**
     * <p>The camera device automatically detects whether the application does zoom with
     * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and in turn decides which
     * metadata tag reflects the effective zoom level.</p>
     *
     * @see CaptureRequest#CONTROL_ZOOM_RATIO
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CaptureRequest#CONTROL_ZOOM_METHOD
     */
    @FlaggedApi(Flags.FLAG_ZOOM_METHOD)
    public static final int CONTROL_ZOOM_METHOD_AUTO = 0;

    /**
     * <p>The application intends to control zoom via {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and
     * the effective zoom level is reflected by {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in capture results.</p>
     *
     * @see CaptureRequest#CONTROL_ZOOM_RATIO
     * @see CaptureRequest#CONTROL_ZOOM_METHOD
     */
    @FlaggedApi(Flags.FLAG_ZOOM_METHOD)
    public static final int CONTROL_ZOOM_METHOD_ZOOM_RATIO = 1;

    //
    // Enumeration values for CaptureRequest#EDGE_MODE
    //
+39 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.impl.ExtensionKey;
import android.hardware.camera2.impl.PublicKey;
import android.hardware.camera2.impl.SyntheticKey;
import android.hardware.camera2.params.OutputConfiguration;
@@ -2667,6 +2666,45 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    public static final Key<Integer> CONTROL_AUTOFRAMING =
            new Key<Integer>("android.control.autoframing", int.class);

    /**
     * <p>Whether the application uses {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}
     * to control zoom levels.</p>
     * <p>If set to AUTO, the camera device detects which capture request key the application uses
     * to do zoom, {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. If
     * the application doesn't set android.scaler.zoomRatio or sets it to 1.0 in the capture
     * request, the effective zoom level is reflected in {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} in capture
     * results. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to values other than 1.0, the effective
     * zoom level is reflected in {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. AUTO is the default value
     * for this control, and also the behavior of the OS before Android version
     * {@link android.os.Build.VERSION_CODES#BAKLAVA BAKLAVA}.</p>
     * <p>If set to ZOOM_RATIO, the application explicitly specifies zoom level be controlled
     * by {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and the effective zoom level is reflected in
     * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in capture results. This addresses an ambiguity with AUTO,
     * with which the camera device cannot know if the application is using cropRegion or
     * zoomRatio at 1.0x.</p>
     * <p><b>Possible values:</b></p>
     * <ul>
     *   <li>{@link #CONTROL_ZOOM_METHOD_AUTO AUTO}</li>
     *   <li>{@link #CONTROL_ZOOM_METHOD_ZOOM_RATIO ZOOM_RATIO}</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_ZOOM_METHOD_AUTO
     * @see #CONTROL_ZOOM_METHOD_ZOOM_RATIO
     */
    @PublicKey
    @NonNull
    @FlaggedApi(Flags.FLAG_ZOOM_METHOD)
    public static final Key<Integer> CONTROL_ZOOM_METHOD =
            new Key<Integer>("android.control.zoomMethod", int.class);

    /**
     * <p>Operation mode for edge
     * enhancement.</p>
+39 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.impl.CaptureResultExtras;
import android.hardware.camera2.impl.ExtensionKey;
import android.hardware.camera2.impl.PublicKey;
import android.hardware.camera2.impl.SyntheticKey;
import android.hardware.camera2.utils.TypeReference;
@@ -2914,6 +2913,45 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
    public static final Key<Integer> CONTROL_LOW_LIGHT_BOOST_STATE =
            new Key<Integer>("android.control.lowLightBoostState", int.class);

    /**
     * <p>Whether the application uses {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}
     * to control zoom levels.</p>
     * <p>If set to AUTO, the camera device detects which capture request key the application uses
     * to do zoom, {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. If
     * the application doesn't set android.scaler.zoomRatio or sets it to 1.0 in the capture
     * request, the effective zoom level is reflected in {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} in capture
     * results. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to values other than 1.0, the effective
     * zoom level is reflected in {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. AUTO is the default value
     * for this control, and also the behavior of the OS before Android version
     * {@link android.os.Build.VERSION_CODES#BAKLAVA BAKLAVA}.</p>
     * <p>If set to ZOOM_RATIO, the application explicitly specifies zoom level be controlled
     * by {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and the effective zoom level is reflected in
     * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} in capture results. This addresses an ambiguity with AUTO,
     * with which the camera device cannot know if the application is using cropRegion or
     * zoomRatio at 1.0x.</p>
     * <p><b>Possible values:</b></p>
     * <ul>
     *   <li>{@link #CONTROL_ZOOM_METHOD_AUTO AUTO}</li>
     *   <li>{@link #CONTROL_ZOOM_METHOD_ZOOM_RATIO ZOOM_RATIO}</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_ZOOM_METHOD_AUTO
     * @see #CONTROL_ZOOM_METHOD_ZOOM_RATIO
     */
    @PublicKey
    @NonNull
    @FlaggedApi(Flags.FLAG_ZOOM_METHOD)
    public static final Key<Integer> CONTROL_ZOOM_METHOD =
            new Key<Integer>("android.control.zoomMethod", int.class);

    /**
     * <p>Operation mode for edge
     * enhancement.</p>