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

Commit 685f8223 authored by Jayant Chowdhary's avatar Jayant Chowdhary Committed by Automerger Merge Worker
Browse files

Merge "camera2: Add fwk-only tags for SCALER_CROP_REGION and metering...

Merge "camera2: Add fwk-only tags for SCALER_CROP_REGION and metering regions." into sc-dev am: 782b4e9e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15349267

Change-Id: I2d814f9ca0aa4d0f40bf077b277342f4b97a9e05
parents 339b2e4e 782b4e9e
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
@@ -2317,6 +2317,51 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    public static final Key<Float> CONTROL_ZOOM_RATIO =
            new Key<Float>("android.control.zoomRatio", float.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the AF regions has been set
     * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
     * set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#CONTROL_AF_REGIONS
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> CONTROL_AF_REGIONS_SET =
            new Key<Boolean>("android.control.afRegionsSet", boolean.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the AE regions has been set
     * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
     * set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#CONTROL_AE_REGIONS
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> CONTROL_AE_REGIONS_SET =
            new Key<Boolean>("android.control.aeRegionsSet", boolean.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the AF regions has been set
     * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
     * set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#CONTROL_AWB_REGIONS
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> CONTROL_AWB_REGIONS_SET =
            new Key<Boolean>("android.control.awbRegionsSet", boolean.class);

    /**
     * <p>Operation mode for edge
     * enhancement.</p>
@@ -3056,6 +3101,21 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    public static final Key<Integer> SCALER_ROTATE_AND_CROP =
            new Key<Integer>("android.scaler.rotateAndCrop", int.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the scaler crop region
     * ({@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}) has been set by the client and it need
     * not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> SCALER_CROP_REGION_SET =
            new Key<Boolean>("android.scaler.cropRegionSet", boolean.class);

    /**
     * <p>Duration each pixel is exposed to
     * light.</p>
+65 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.hardware.camera2.params.Capability;
import android.hardware.camera2.params.Face;
import android.hardware.camera2.params.HighSpeedVideoConfiguration;
import android.hardware.camera2.params.LensShadingMap;
import android.hardware.camera2.params.MeteringRectangle;
import android.hardware.camera2.params.MandatoryStreamCombination;
import android.hardware.camera2.params.MultiResolutionStreamConfigurationMap;
import android.hardware.camera2.params.OisSample;
@@ -1708,6 +1709,34 @@ public class CameraMetadataNative implements Parcelable {
                metadata.setGpsLocation((Location) value);
            }
        });
        sSetCommandMap.put(CaptureRequest.SCALER_CROP_REGION.getNativeKey(),
                new SetCommand() {
            @Override
            public <T> void setValue(CameraMetadataNative metadata, T value) {
                metadata.setScalerCropRegion((Rect) value);
            }
        });
        sSetCommandMap.put(CaptureRequest.CONTROL_AWB_REGIONS.getNativeKey(),
                new SetCommand() {
            @Override
            public <T> void setValue(CameraMetadataNative metadata, T value) {
                metadata.setAWBRegions((MeteringRectangle[]) value);
            }
        });
        sSetCommandMap.put(CaptureRequest.CONTROL_AF_REGIONS.getNativeKey(),
                new SetCommand() {
            @Override
            public <T> void setValue(CameraMetadataNative metadata, T value) {
                metadata.setAFRegions((MeteringRectangle[]) value);
            }
        });
        sSetCommandMap.put(CaptureRequest.CONTROL_AE_REGIONS.getNativeKey(),
                new SetCommand() {
            @Override
            public <T> void setValue(CameraMetadataNative metadata, T value) {
                metadata.setAERegions((MeteringRectangle[]) value);
            }
        });
    }

    private boolean setAvailableFormats(int[] value) {
@@ -1777,6 +1806,42 @@ public class CameraMetadataNative implements Parcelable {
        return true;
    }

    private <T> boolean setScalerCropRegion(Rect cropRegion) {
        if (cropRegion == null) {
            return false;
        }
        setBase(CaptureRequest.SCALER_CROP_REGION_SET, true);
        setBase(CaptureRequest.SCALER_CROP_REGION, cropRegion);
        return true;
    }

    private <T> boolean setAFRegions(MeteringRectangle[] afRegions) {
        if (afRegions == null) {
            return false;
        }
        setBase(CaptureRequest.CONTROL_AF_REGIONS_SET, true);
        setBase(CaptureRequest.CONTROL_AF_REGIONS, afRegions);
        return true;
    }

    private <T> boolean setAERegions(MeteringRectangle[] aeRegions) {
        if (aeRegions == null) {
            return false;
        }
        setBase(CaptureRequest.CONTROL_AE_REGIONS_SET, true);
        setBase(CaptureRequest.CONTROL_AE_REGIONS, aeRegions);
        return true;
    }

    private <T> boolean setAWBRegions(MeteringRectangle[] awbRegions) {
        if (awbRegions == null) {
            return false;
        }
        setBase(CaptureRequest.CONTROL_AWB_REGIONS_SET, true);
        setBase(CaptureRequest.CONTROL_AWB_REGIONS, awbRegions);
        return true;
    }

    private void updateNativeAllocation() {
        long currentBufferSize = nativeGetBufferSize(mMetadataPtr);