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

Commit abd9d3c5 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera2: API review updates

- Rename CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION
  to TIMESTAMP_SOURCE
- Remove StreamConfigurationMap#NO_MIN_FRAME_DURATION

Bug: 16402755
Change-Id: I6c30a1e931c9f064c22092d362bcc61bd88e2f8a
parent 8b5a858e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -12706,7 +12706,7 @@ package android.hardware.camera2 {
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_PHYSICAL_SIZE;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_PIXEL_ARRAY_SIZE;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_SENSITIVITY_RANGE;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_TIMESTAMP_CALIBRATION;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_TIMESTAMP_SOURCE;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_WHITE_LEVEL;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_MAX_ANALOG_SENSITIVITY;
    field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_ORIENTATION;
@@ -12900,8 +12900,8 @@ package android.hardware.camera2 {
    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG = 1; // 0x1
    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = 4; // 0x4
    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB = 0; // 0x0
    field public static final int SENSOR_INFO_TIMESTAMP_CALIBRATION_CALIBRATED = 1; // 0x1
    field public static final int SENSOR_INFO_TIMESTAMP_CALIBRATION_UNCALIBRATED = 0; // 0x0
    field public static final int SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = 1; // 0x1
    field public static final int SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = 0; // 0x0
    field public static final int SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = 10; // 0xa
    field public static final int SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = 14; // 0xe
    field public static final int SENSOR_REFERENCE_ILLUMINANT1_D50 = 23; // 0x17
@@ -13211,7 +13211,6 @@ package android.hardware.camera2.params {
    method public boolean isOutputSupportedFor(int);
    method public static boolean isOutputSupportedFor(java.lang.Class<T>);
    method public boolean isOutputSupportedFor(android.view.Surface);
    field public static final long NO_MIN_FRAME_DURATION = 0L; // 0x0L
  }
  public final class TonemapCurve {
+9 −9
Original line number Diff line number Diff line
@@ -1551,17 +1551,17 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
            new Key<Integer>("android.sensor.info.whiteLevel", int.class);

    /**
     * <p>The sensor timestamp calibration quality.</p>
     * <p>The sensor timestamp calibration quality determines the reliability of
     * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} provided by the camera device.</p>
     *
     * @see CaptureResult#SENSOR_TIMESTAMP
     * @see #SENSOR_INFO_TIMESTAMP_CALIBRATION_UNCALIBRATED
     * @see #SENSOR_INFO_TIMESTAMP_CALIBRATION_CALIBRATED
     * <p>The time base source for sensor capture start timestamps.</p>
     * <p>The timestamps provided for captures are always in nanoseconds and monotonic, but
     * may not based on a time source that can be compared to other system time sources.</p>
     * <p>This characteristic defines the source for the timestamps, and therefore whether they
     * can be compared against other system time sources/timestamps.</p>
     * @see #SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN
     * @see #SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME
     */
    @PublicKey
    public static final Key<Integer> SENSOR_INFO_TIMESTAMP_CALIBRATION =
            new Key<Integer>("android.sensor.info.timestampCalibration", int.class);
    public static final Key<Integer> SENSOR_INFO_TIMESTAMP_SOURCE =
            new Key<Integer>("android.sensor.info.timestampSource", int.class);

    /**
     * <p>The standard reference illuminant used as the scene light source when
+6 −7
Original line number Diff line number Diff line
@@ -494,7 +494,7 @@ public abstract class CameraMetadata<TKey> {
    public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = 4;

    //
    // Enumeration values for CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION
    // Enumeration values for CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
    //

    /**
@@ -506,9 +506,9 @@ public abstract class CameraMetadata<TKey> {
     * and the result metadata generated by a single capture are identical.</p>
     *
     * @see CaptureResult#SENSOR_TIMESTAMP
     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION
     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
     */
    public static final int SENSOR_INFO_TIMESTAMP_CALIBRATION_UNCALIBRATED = 0;
    public static final int SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = 0;

    /**
     * <p>Timestamps from {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} are in the same timebase as
@@ -516,9 +516,9 @@ public abstract class CameraMetadata<TKey> {
     * and they can be compared to other timestamps using that base.</p>
     *
     * @see CaptureResult#SENSOR_TIMESTAMP
     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION
     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
     */
    public static final int SENSOR_INFO_TIMESTAMP_CALIBRATION_CALIBRATED = 1;
    public static final int SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = 1;

    //
    // Enumeration values for CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1
@@ -1208,8 +1208,7 @@ public abstract class CameraMetadata<TKey> {
     * image while recording video) use case.</p>
     * <p>The camera device should take the highest-quality image
     * possible (given the other settings) without disrupting the
     * frame rate of video recording.<br />
     * </p>
     * frame rate of video recording.  </p>
     * @see CaptureRequest#CONTROL_CAPTURE_INTENT
     */
    public static final int CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4;
+3 −3
Original line number Diff line number Diff line
@@ -2221,18 +2221,18 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
     * <p>The timestamps are also included in all image
     * buffers produced for the same capture, and will be identical
     * on all the outputs.</p>
     * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION android.sensor.info.timestampCalibration} <code>==</code> UNCALIBRATED,
     * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE android.sensor.info.timestampSource} <code>==</code> UNKNOWN,
     * the timestamps measure time since an unspecified starting point,
     * and are monotonically increasing. They can be compared with the
     * timestamps for other captures from the same camera device, but are
     * not guaranteed to be comparable to any other time source.</p>
     * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION android.sensor.info.timestampCalibration} <code>==</code> CALIBRATED,
     * <p>When {@link CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE android.sensor.info.timestampSource} <code>==</code> REALTIME,
     * the timestamps measure time in the same timebase as
     * android.os.SystemClock#elapsedRealtimeNanos(), and they can be
     * compared to other timestamps from other subsystems that are using
     * that base.</p>
     *
     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_CALIBRATION
     * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
     */
    @PublicKey
    public static final Key<Long> SENSOR_TIMESTAMP =
+6 −22
Original line number Diff line number Diff line
@@ -66,11 +66,6 @@ public final class StreamConfigurationMap {

    private static final String TAG = "StreamConfigurationMap";

    /**
     * Indicates that a minimum frame duration is not available for a particular configuration.
     */
    public static final long NO_MIN_FRAME_DURATION = 0;

    /**
     * Create a new {@link StreamConfigurationMap}.
     *
@@ -536,7 +531,7 @@ public final class StreamConfigurationMap {
     *
     * <p>For devices that do not support manual sensor control
     * ({@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR}),
     * this function may return {@link #NO_MIN_FRAME_DURATION}.</p>
     * this function may return 0.</p>
     *
     * <!--
     * TODO: uncomment after adding input stream support
@@ -547,7 +542,7 @@ public final class StreamConfigurationMap {
     * @param format an image format from {@link ImageFormat} or {@link PixelFormat}
     * @param size an output-compatible size
     * @return a minimum frame duration {@code >} 0 in nanoseconds, or
     *          {@link #NO_MIN_FRAME_DURATION} if the minimum frame duration is not available.
     *          0 if the minimum frame duration is not available.
     *
     * @throws IllegalArgumentException if {@code format} or {@code size} was not supported
     * @throws NullPointerException if {@code size} was {@code null}
@@ -586,7 +581,7 @@ public final class StreamConfigurationMap {
     *
     * <p>For devices that do not support manual sensor control
     * ({@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR}),
     * this function may return {@link #NO_MIN_FRAME_DURATION}.</p>
     * this function may return 0.</p>
     *
     * <!--
     * TODO: uncomment after adding input stream support
@@ -599,7 +594,7 @@ public final class StreamConfigurationMap {
     *          non-empty array returned by {@link #getOutputSizes(Class)}
     * @param size an output-compatible size
     * @return a minimum frame duration {@code >} 0 in nanoseconds, or
     *          {@link #NO_MIN_FRAME_DURATION} if the minimum frame duration is not available.
     *          0 if the minimum frame duration is not available.
     *
     * @throws IllegalArgumentException if {@code klass} or {@code size} was not supported
     * @throws NullPointerException if {@code size} or {@code klass} was {@code null}
@@ -1065,8 +1060,8 @@ public final class StreamConfigurationMap {
                return configurationDuration.getDuration();
            }
        }

        return getDurationDefault(duration);
        // Default duration is '0' (unsupported/no extra stall)
        return 0;
    }

    /**
@@ -1086,17 +1081,6 @@ public final class StreamConfigurationMap {
        }
    }

    private long getDurationDefault(int duration) {
        switch (duration) {
            case DURATION_MIN_FRAME:
                return NO_MIN_FRAME_DURATION;
            case DURATION_STALL:
                return 0L; // OK. A lack of a stall duration implies a 0 stall duration
            default:
                throw new IllegalArgumentException("duration was invalid");
        }
    }

    /** Count the number of publicly-visible output formats */
    private int getPublicFormatCount(boolean output) {
        HashMap<Integer, Integer> formatsMap = getFormatsMap(output);