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

Commit f00457ae authored by Austin Borger's avatar Austin Borger Committed by Android (Google) Code Review
Browse files

Merge "Create API for reporting color space support to Camera2 framework consumers."

parents 62c418fc f665d506
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -17630,6 +17630,7 @@ package android.hardware.camera2 {
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REPROCESS_MAX_CAPTURE_STALL;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> REQUEST_AVAILABLE_CAPABILITIES;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceProfiles> REQUEST_AVAILABLE_COLOR_SPACE_PROFILES;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.DynamicRangeProfiles> REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_INPUT_STREAMS;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC;
@@ -17993,6 +17994,7 @@ package android.hardware.camera2 {
    field public static final int NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG = 4; // 0x4
    field public static final int REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0; // 0x0
    field public static final int REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE = 6; // 0x6
    field public static final int REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES = 20; // 0x14
    field public static final int REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO = 9; // 0x9
    field public static final int REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = 8; // 0x8
    field public static final int REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT = 18; // 0x12
@@ -18344,6 +18346,15 @@ package android.hardware.camera2.params {
    method @NonNull public android.util.Range<java.lang.Float> getZoomRatioRange();
  }
  public final class ColorSpaceProfiles {
    ctor public ColorSpaceProfiles(@NonNull long[]);
    method @NonNull public java.util.Set<android.graphics.ColorSpace.Named> getSupportedColorSpaces(int);
    method @NonNull public java.util.Set<android.graphics.ColorSpace.Named> getSupportedColorSpacesForDynamicRange(int, long);
    method @NonNull public java.util.Set<java.lang.Long> getSupportedDynamicRangeProfiles(@NonNull android.graphics.ColorSpace.Named, int);
    method @NonNull public java.util.Set<java.lang.Integer> getSupportedImageFormatsForColorSpace(@NonNull android.graphics.ColorSpace.Named);
    field public static final int UNSPECIFIED = -1; // 0xffffffff
  }
  public final class ColorSpaceTransform {
    ctor public ColorSpaceTransform(android.util.Rational[]);
    ctor public ColorSpaceTransform(int[]);
@@ -18575,13 +18586,16 @@ package android.hardware.camera2.params {
  public final class SessionConfiguration implements android.os.Parcelable {
    ctor public SessionConfiguration(int, @NonNull java.util.List<android.hardware.camera2.params.OutputConfiguration>, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback);
    method public void clearColorSpace();
    method public int describeContents();
    method @Nullable public android.graphics.ColorSpace getColorSpace();
    method public java.util.concurrent.Executor getExecutor();
    method public android.hardware.camera2.params.InputConfiguration getInputConfiguration();
    method public java.util.List<android.hardware.camera2.params.OutputConfiguration> getOutputConfigurations();
    method public android.hardware.camera2.CaptureRequest getSessionParameters();
    method public int getSessionType();
    method public android.hardware.camera2.CameraCaptureSession.StateCallback getStateCallback();
    method public void setColorSpace(@NonNull android.graphics.ColorSpace.Named);
    method public void setInputConfiguration(@NonNull android.hardware.camera2.params.InputConfiguration);
    method public void setSessionParameters(android.hardware.camera2.CaptureRequest);
    method public void writeToParcel(android.os.Parcel, int);
+14 −0
Original line number Diff line number Diff line
@@ -1170,6 +1170,20 @@ package android.hardware.camera2 {

}

package android.hardware.camera2.params {

  public final class ColorSpaceProfiles {
    method @NonNull public java.util.Map<android.graphics.ColorSpace.Named,java.util.Map<java.lang.Integer,java.util.Set<java.lang.Long>>> getProfileMap();
  }

  public final class OutputConfiguration implements android.os.Parcelable {
    method public void clearColorSpace();
    method @Nullable public android.graphics.ColorSpace getColorSpace();
    method public void setColorSpace(@NonNull android.graphics.ColorSpace.Named);
  }

}

package android.hardware.devicestate {

  public final class DeviceStateManager {
+11 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package android.hardware;

import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.params.ColorSpaceProfiles;
import android.hardware.camera2.params.DynamicRangeProfiles;
import android.os.Parcel;
import android.os.Parcelable;
@@ -50,6 +51,7 @@ public class CameraStreamStats implements Parcelable {
    private long[] mHistogramCounts;
    private long mDynamicRangeProfile;
    private long mStreamUseCase;
    private int mColorSpace;

    private static final String TAG = "CameraStreamStats";

@@ -68,12 +70,13 @@ public class CameraStreamStats implements Parcelable {
        mHistogramType = HISTOGRAM_TYPE_UNKNOWN;
        mDynamicRangeProfile = DynamicRangeProfiles.STANDARD;
        mStreamUseCase = CameraMetadata.SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT;
        mColorSpace = ColorSpaceProfiles.UNSPECIFIED;
    }

    public CameraStreamStats(int width, int height, int format, float maxPreviewFps,
            int dataSpace, long usage, long requestCount, long errorCount,
            int startLatencyMs, int maxHalBuffers, int maxAppBuffers, long dynamicRangeProfile,
            long streamUseCase) {
            long streamUseCase, int colorSpace) {
        mWidth = width;
        mHeight = height;
        mFormat = format;
@@ -88,6 +91,7 @@ public class CameraStreamStats implements Parcelable {
        mHistogramType = HISTOGRAM_TYPE_UNKNOWN;
        mDynamicRangeProfile = dynamicRangeProfile;
        mStreamUseCase = streamUseCase;
        mColorSpace = colorSpace;
    }

    public static final @android.annotation.NonNull Parcelable.Creator<CameraStreamStats> CREATOR =
@@ -136,6 +140,7 @@ public class CameraStreamStats implements Parcelable {
        dest.writeLongArray(mHistogramCounts);
        dest.writeLong(mDynamicRangeProfile);
        dest.writeLong(mStreamUseCase);
        dest.writeInt(mColorSpace);
    }

    public void readFromParcel(Parcel in) {
@@ -155,6 +160,7 @@ public class CameraStreamStats implements Parcelable {
        mHistogramCounts = in.createLongArray();
        mDynamicRangeProfile = in.readLong();
        mStreamUseCase = in.readLong();
        mColorSpace = in.readInt();
    }

    public int getWidth() {
@@ -217,6 +223,10 @@ public class CameraStreamStats implements Parcelable {
        return mDynamicRangeProfile;
    }

    public int getColorSpace() {
        return mColorSpace;
    }

    public long getStreamUseCase() {
        return mStreamUseCase;
    }
+78 −0
Original line number Diff line number Diff line
@@ -2224,6 +2224,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
     *   <li>{@link #REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING REMOSAIC_REPROCESSING}</li>
     *   <li>{@link #REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT DYNAMIC_RANGE_TEN_BIT}</li>
     *   <li>{@link #REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE STREAM_USE_CASE}</li>
     *   <li>{@link #REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES COLOR_SPACE_PROFILES}</li>
     * </ul>
     *
     * <p>This key is available on all devices.</p>
@@ -2249,6 +2250,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
     * @see #REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING
     * @see #REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT
     * @see #REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE
     * @see #REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES
     */
    @PublicKey
    @NonNull
@@ -2472,6 +2474,82 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
    public static final Key<Long> REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE =
            new Key<Long>("android.request.recommendedTenBitDynamicRangeProfile", long.class);

    /**
     * <p>An interface for querying the color space profiles supported by a camera device.</p>
     * <p>A color space profile is a combination of a color space, an image format, and a dynamic
     * range profile. Camera clients can retrieve the list of supported color spaces by calling
     * {@link android.hardware.camera2.params.ColorSpaceProfiles#getSupportedColorSpaces } or
     * {@link android.hardware.camera2.params.ColorSpaceProfiles#getSupportedColorSpacesForDynamicRange }.
     * If a camera does not support the
     * {@link android.hardware.camera2.CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT }
     * capability, the dynamic range profile will always be
     * {@link android.hardware.camera2.params.DynamicRangeProfiles#STANDARD }. Color space
     * capabilities are queried in combination with an {@link android.graphics.ImageFormat }.
     * If a camera client wants to know the general color space capabilities of a camera device
     * regardless of image format, it can specify {@link android.graphics.ImageFormat#UNKNOWN }.
     * The color space for a session can be configured by setting the SessionConfiguration
     * color space via {@link android.hardware.camera2.params.SessionConfiguration#setColorSpace }.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     */
    @PublicKey
    @NonNull
    @SyntheticKey
    public static final Key<android.hardware.camera2.params.ColorSpaceProfiles> REQUEST_AVAILABLE_COLOR_SPACE_PROFILES =
            new Key<android.hardware.camera2.params.ColorSpaceProfiles>("android.request.availableColorSpaceProfiles", android.hardware.camera2.params.ColorSpaceProfiles.class);

    /**
     * <p>A list of all possible color space profiles supported by a camera device.</p>
     * <p>A color space profile is a combination of a color space, an image format, and a dynamic range
     * profile. If a camera does not support the
     * {@link android.hardware.camera2.CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT }
     * capability, the dynamic range profile will always be
     * {@link android.hardware.camera2.params.DynamicRangeProfiles#STANDARD }. Camera clients can
     * use {@link android.hardware.camera2.params.SessionConfiguration#setColorSpace } to select
     * a color space.</p>
     * <p><b>Possible values:</b></p>
     * <ul>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED UNSPECIFIED}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB SRGB}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB LINEAR_SRGB}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB EXTENDED_SRGB}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB LINEAR_EXTENDED_SRGB}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 BT709}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 BT2020}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 DCI_P3}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 DISPLAY_P3}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 NTSC_1953}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C SMPTE_C}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB ADOBE_RGB}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB PRO_PHOTO_RGB}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES ACES}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG ACESCG}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ CIE_XYZ}</li>
     *   <li>{@link #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB CIE_LAB}</li>
     * </ul>
     *
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ
     * @see #REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB
     * @hide
     */
    public static final Key<long[]> REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP =
            new Key<long[]>("android.request.availableColorSpaceProfilesMap", long[].class);

    /**
     * <p>The list of image formats that are supported by this
     * camera device for output streams.</p>
+30 −0
Original line number Diff line number Diff line
@@ -1257,6 +1257,24 @@ public abstract class CameraMetadata<TKey> {
     */
    public static final int REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE = 19;

    /**
     * <p>The device supports querying the possible combinations of color spaces, image
     * formats, and dynamic range profiles supported by the camera and requesting a
     * particular color space for a session via
     * {@link android.hardware.camera2.params.SessionConfiguration#setColorSpace }.</p>
     * <p>Cameras that enable this capability may or may not also implement dynamic range
     * profiles. If they don't,
     * {@link android.hardware.camera2.params.ColorSpaceProfiles#getSupportedDynamicRangeProfiles }
     * will return only
     * {@link android.hardware.camera2.params.DynamicRangeProfiles#STANDARD } and
     * {@link android.hardware.camera2.params.ColorSpaceProfiles#getSupportedColorSpacesForDynamicRange }
     * will assume support of the
     * {@link android.hardware.camera2.params.DynamicRangeProfiles#STANDARD }
     * profile in all combinations of color spaces and image formats.</p>
     * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
     */
    public static final int REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES = 20;

    //
    // Enumeration values for CameraCharacteristics#REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP
    //
@@ -1366,6 +1384,18 @@ public abstract class CameraMetadata<TKey> {
     */
    public static final int REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 0x1000;

    //
    // Enumeration values for CameraCharacteristics#REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP
    //

    /**
     * <p>Default value, when not explicitly specified. The Camera device will choose the color
     * space to employ.</p>
     * @see CameraCharacteristics#REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP
     * @hide
     */
    public static final int REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1;

    //
    // Enumeration values for CameraCharacteristics#SCALER_CROPPING_TYPE
    //
Loading