/* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.camera2; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraExtensionCharacteristics; import android.hardware.camera2.CaptureResult; import android.hardware.camera2.CaptureResult.Key; import android.hardware.camera2.impl.ExtensionKey; import android.hardware.camera2.impl.PublicKey; import com.android.internal.camera.flags.Flags; /** * ExtensionCaptureResult contains definitions for extension-specific CaptureResult keys that * are available during a {@link android.hardware.camera2.CameraExtensionSession} after a * {@link android.hardware.camera2.CaptureRequest} is processed. * * Note that ExtensionCaptureResult is not intended to be used as a replacement * for CaptureResult in the extensions. It serves as a supplementary class providing * extension-specific CaptureResult keys. Developers should use these keys in conjunction * with regular CaptureResult objects during a * {@link android.hardware.camera2.CameraExtensionSession}. * * @see CaptureResult * @see CaptureRequest * @see CameraExtensionSession */ @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public final class ExtensionCaptureResult { /** *
The padding region for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*An array [left, top, right, bottom] of the padding in pixels remaining on all four sides * before the target region starts to go out of bounds.
*The padding region denotes the area surrounding the stabilized target region within which * the camera can be moved while maintaining the target region in view. As the camera moves, * the padding region adjusts to represent the proximity of the target region to the * boundary, which is the point at which the target region will start to go out of bounds.
*Range of valid values:
* The padding is the number of remaining pixels of padding in each direction.
* The pixels reference the active array coordinate system. Negative values indicate the target region
* is out of bounds. The value for this key may be null for when the stabilization mode is
* in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_OFF }
* or {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_GIMBAL } mode.
Optional - The value for this key may be {@code null} on some devices.
*/ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyThe padding region when {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*An array [left, top, right, bottom] of the padding in pixels remaining on all four sides * before the target region starts to go out of bounds.
*This may differ from {@link ExtensionCaptureResult#EFV_PADDING_REGION } as the field of view can change * during {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM }, altering the boundary region and thus updating the padding between the * target region and the boundary.
*Range of valid values:
* The padding is the number of remaining pixels of padding in each direction
* when {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled. Negative values indicate the target region is out of bounds.
* The value for this key may be null for when the {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is not enabled.
Optional - The value for this key may be {@code null} on some devices.
* * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM * @see ExtensionCaptureResult#EFV_PADDING_REGION */ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyList of coordinates representing the target region relative to the * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE } * for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*A list of android.graphics.PointF that define the coordinates of the target region * relative to the * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE }. * The array represents the target region coordinates as: top-left, top-right, bottom-left, * bottom-right.
*Range of valid values:
* The list of target coordinates will define a region within the bounds of the
* {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE }
Optional - The value for this key may be {@code null} on some devices.
*/ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyUsed to apply an additional digital zoom factor for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*For the {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * feature, an additional zoom factor is applied on top of the existing {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. * This additional zoom factor serves as a buffer to provide more flexibility for the * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } * mode. If {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } is not set, the default will be used. * The effectiveness of the stabilization may be influenced by the amount of padding zoom * applied. A higher padding zoom factor can stabilize the target region more effectively * with greater flexibility but may potentially impact image quality. Conversely, a lower * padding zoom factor may be used to prioritize preserving image quality, albeit with less * leeway in stabilizing the target region. It is recommended to set the * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } to at least 1.5.
*If {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled, the requested {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } will be overridden. * {@link ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR } can be checked for more details on controlling the * padding zoom factor during {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM }.
*Range of valid values:
* {@link CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE }
Optional - The value for this key may be {@code null} on some devices.
* * @see CaptureRequest#CONTROL_ZOOM_RATIO * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM * @see ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR * @see CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE */ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeySet the stabilization mode for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension
*The desired stabilization mode. Gimbal stabilization mode provides simple, non-locked * video stabilization. Locked mode uses the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * stabilization feature to fixate on the current region, utilizing it as the target area for * stabilization.
*Possible values:
*Optional - The value for this key may be {@code null} on some devices.
* @see #EFV_STABILIZATION_MODE_OFF * @see #EFV_STABILIZATION_MODE_GIMBAL * @see #EFV_STABILIZATION_MODE_LOCKED */ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyUsed to enable or disable auto zoom for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*Turn on auto zoom to let the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * feature decide at any given point a combination of * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} and {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } * to keep the target region in view and stabilized. The combination chosen by the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * will equal the requested {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} multiplied with the requested * {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR }. A limit can be set on the padding zoom if wanting * to control image quality further using {@link ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR }.
*Optional - The value for this key may be {@code null} on some devices.
* * @see CaptureRequest#CONTROL_ZOOM_RATIO * @see ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR */ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyRepresenting the desired clockwise rotation * of the target region in degrees for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*Value representing the desired clockwise rotation of the target * region in degrees.
*Range of valid values:
* 0 to 360
Optional - The value for this key may be {@code null} on some devices.
*/ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyUsed to update the target region for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*A android.util.Pair
Range of valid values:
* android.util.Pair
Optional - The value for this key may be {@code null} on some devices.
* * @see ExtensionCaptureResult#EFV_PADDING_REGION */ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final KeyUsed to limit the {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } if * {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled for the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.
*If {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled, this key can be used to set a limit * on the {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } chosen by the * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode * to control image quality.
*Range of valid values:
* The range of {@link CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE }. Use a value greater than or equal to
* the {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } to
* effectively utilize this key.
Optional - The value for this key may be {@code null} on some devices.
* * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR * @see CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE */ @PublicKey @NonNull @ExtensionKey @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) public static final Key