Merge "Camera2: Update capabilities metadata"
diff --git a/api/current.txt b/api/current.txt
index d235fa4..8230785 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12612,9 +12612,10 @@
     field public static final int NOISE_REDUCTION_MODE_FAST = 1; // 0x1
     field public static final int NOISE_REDUCTION_MODE_HIGH_QUALITY = 2; // 0x2
     field public static final int NOISE_REDUCTION_MODE_OFF = 0; // 0x0
-    field public static final int REQUEST_AVAILABLE_CAPABILITIES_DNG = 5; // 0x5
-    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 3; // 0x3
-    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 2; // 0x2
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0; // 0x0
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_DNG = 3; // 0x3
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2; // 0x2
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 1; // 0x1
     field public static final int SCALER_CROPPING_TYPE_CENTER_ONLY = 0; // 0x0
     field public static final int SCALER_CROPPING_TYPE_FREEFORM = 1; // 0x1
     field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR = 3; // 0x3
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index f35a819..44e3f76 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -862,6 +862,7 @@
      * devices, but the application should query this field to be sure.</p>
      *
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
+     * @see #REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE
      * @see #REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR
      * @see #REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING
      * @see #REQUEST_AVAILABLE_CAPABILITIES_DNG
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 6c3f7dd..6eeeff2 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -217,28 +217,18 @@
     /**
      * <p>The minimal set of capabilities that every camera
      * device (regardless of {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel})
-     * will support.</p>
-     * <p>The full set of features supported by this capability makes
-     * the camera2 api backwards compatible with the camera1
-     * (android.hardware.Camera) API.</p>
+     * supports.</p>
+     * <p>This capability is listed by all devices, and
+     * indicates that the camera device has a feature set
+     * that's comparable to the baseline requirements for the
+     * older android.hardware.Camera API.</p>
      *
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
-     * @hide
      */
     public static final int REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0;
 
     /**
-     * <p>This is a catch-all capability to include all other
-     * tags or functionality not encapsulated by one of the other
-     * capabilities.</p>
-     * <p>A typical example is all tags marked 'optional'.</p>
-     * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
-     * @hide
-     */
-    public static final int REQUEST_AVAILABLE_CAPABILITIES_OPTIONAL = 1;
-
-    /**
      * <p>The camera device can be manually controlled (3A algorithms such
      * as auto-exposure, and auto-focus can be bypassed).
      * The camera device supports basic manual control of the sensor image
@@ -292,7 +282,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
      */
-    public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 2;
+    public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 1;
 
     /**
      * <p>The camera device post-processing stages can be manually controlled.
@@ -339,7 +329,26 @@
      * @see CaptureRequest#TONEMAP_MODE
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
      */
-    public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 3;
+    public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2;
+
+    /**
+     * <p>The camera device supports outputting RAW buffers that can be
+     * saved offline into a DNG format.</p>
+     * <ul>
+     * <li>RAW_SENSOR is supported as an output format.</li>
+     * <li>The maximum available resolution for RAW_SENSOR streams
+     * will match either the value in
+     * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize} or
+     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</li>
+     * <li>All DNG-related optional metadata entries are provided
+     * by the camera device.</li>
+     * </ul>
+     *
+     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
+     * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
+     * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
+     */
+    public static final int REQUEST_AVAILABLE_CAPABILITIES_DNG = 3;
 
     /**
      * <p>The camera device supports the Zero Shutter Lag use case.</p>
@@ -360,29 +369,6 @@
      */
     public static final int REQUEST_AVAILABLE_CAPABILITIES_ZSL = 4;
 
-    /**
-     * <p>The camera device supports outputting RAW buffers that can be
-     * saved offline into a DNG format. It can reprocess DNG
-     * files (produced from the same camera device) back into YUV.</p>
-     * <ul>
-     * <li>At least one input stream can be used.</li>
-     * <li>RAW16 is supported as output/input format.</li>
-     * <li>RAW16 is reprocessable into both YUV_420_888 and JPEG
-     * formats.</li>
-     * <li>The maximum available resolution for RAW16 streams (both
-     * input/output) will match either the value in
-     * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize} or
-     * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</li>
-     * <li>All DNG-related optional metadata entries are provided
-     * by the camera device.</li>
-     * </ul>
-     *
-     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
-     * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
-     * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
-     */
-    public static final int REQUEST_AVAILABLE_CAPABILITIES_DNG = 5;
-
     //
     // Enumeration values for CameraCharacteristics#SCALER_CROPPING_TYPE
     //
@@ -1145,8 +1131,7 @@
      * 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;
diff --git a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
index fff171b..8385d63 100644
--- a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
+++ b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
@@ -357,6 +357,10 @@
      * <p>When multiple streams are used in a request, the minimum frame duration will be
      * {@code max(individual stream min durations)}.</p>
      *
+     * <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>
+     *
      * <!--
      * TODO: uncomment after adding input stream support
      * <p>The minimum frame duration of a stream (of a particular format, size) is the same
@@ -366,8 +370,7 @@
      * @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 (this
-     *          can only occur on limited mode devices).
+     *          {@link #NO_MIN_FRAME_DURATION} 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}
@@ -404,6 +407,10 @@
      * <p>When multiple streams are used in a request, the minimum frame duration will be
      * {@code max(individual stream min durations)}.</p>
      *
+     * <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>
+     *
      * <!--
      * TODO: uncomment after adding input stream support
      * <p>The minimum frame duration of a stream (of a particular format, size) is the same
@@ -415,8 +422,7 @@
      *          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 (this
-     *          can only occur on limited mode devices).
+     *          {@link #NO_MIN_FRAME_DURATION} 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}