Merge "Camera2: Update FAST mode for EE and NR" into mnc-dev
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index e8b362b..495ea6e 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -3954,21 +3954,21 @@
                     <span class="entry_type_enum_optional">[optional]</span>
                     <span class="entry_type_enum_hidden">[hidden]</span>
                     <span class="entry_type_enum_notes"><p>Same as FACE_<wbr/>PRIORITY scene mode,<wbr/> except that the camera
-device will choose higher sensivity values (<a href="#controls_android.sensor.sensitivity">android.<wbr/>sensor.<wbr/>sensitivity</a>)
+device will choose higher sensitivity values (<a href="#controls_android.sensor.sensitivity">android.<wbr/>sensor.<wbr/>sensitivity</a>)
 under low light conditions.<wbr/></p>
 <p>The camera device may be tuned to expose the images in a reduced
 sensitivity range to produce the best quality images.<wbr/> For example,<wbr/>
 if the <a href="#static_android.sensor.info.sensitivityRange">android.<wbr/>sensor.<wbr/>info.<wbr/>sensitivity<wbr/>Range</a> gives range of [100,<wbr/> 1600],<wbr/>
 the camera device auto-exposure routine tuning process may limit the actual
-exposure sensivity range to [100,<wbr/> 1200] to ensure that the noise level isn't
-exessive to compromise the image quality.<wbr/> Under this situation,<wbr/> the image under
+exposure sensitivity range to [100,<wbr/> 1200] to ensure that the noise level isn't
+exessive in order to preserve the image quality.<wbr/> Under this situation,<wbr/> the image under
 low light may be under-exposed when the sensor max exposure time (bounded by the
 <a href="#controls_android.control.aeTargetFpsRange">android.<wbr/>control.<wbr/>ae<wbr/>Target<wbr/>Fps<wbr/>Range</a> when <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> is one of the
-ON_<wbr/>* modes) and effecitve max sensitivity are reached.<wbr/> This scene mode allows the
+ON_<wbr/>* modes) and effective max sensitivity are reached.<wbr/> This scene mode allows the
 camera device auto-exposure routine to increase the sensitivity up to the max
 sensitivity specified by <a href="#static_android.sensor.info.sensitivityRange">android.<wbr/>sensor.<wbr/>info.<wbr/>sensitivity<wbr/>Range</a> when the scene is too
 dark and the max exposure time is reached.<wbr/> The captured images may be noisier
-compared with the images captured in normal FACE_<wbr/>PRIORITY mode,<wbr/> therefore,<wbr/> it is
+compared with the images captured in normal FACE_<wbr/>PRIORITY mode; therefore,<wbr/> it is
 recommended that the application only use this scene mode when it is capable of
 reducing the noise level of the captured images.<wbr/></p>
 <p>Unlike the other scene modes,<wbr/> <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a>,<wbr/>
@@ -8424,21 +8424,21 @@
                     <span class="entry_type_enum_optional">[optional]</span>
                     <span class="entry_type_enum_hidden">[hidden]</span>
                     <span class="entry_type_enum_notes"><p>Same as FACE_<wbr/>PRIORITY scene mode,<wbr/> except that the camera
-device will choose higher sensivity values (<a href="#controls_android.sensor.sensitivity">android.<wbr/>sensor.<wbr/>sensitivity</a>)
+device will choose higher sensitivity values (<a href="#controls_android.sensor.sensitivity">android.<wbr/>sensor.<wbr/>sensitivity</a>)
 under low light conditions.<wbr/></p>
 <p>The camera device may be tuned to expose the images in a reduced
 sensitivity range to produce the best quality images.<wbr/> For example,<wbr/>
 if the <a href="#static_android.sensor.info.sensitivityRange">android.<wbr/>sensor.<wbr/>info.<wbr/>sensitivity<wbr/>Range</a> gives range of [100,<wbr/> 1600],<wbr/>
 the camera device auto-exposure routine tuning process may limit the actual
-exposure sensivity range to [100,<wbr/> 1200] to ensure that the noise level isn't
-exessive to compromise the image quality.<wbr/> Under this situation,<wbr/> the image under
+exposure sensitivity range to [100,<wbr/> 1200] to ensure that the noise level isn't
+exessive in order to preserve the image quality.<wbr/> Under this situation,<wbr/> the image under
 low light may be under-exposed when the sensor max exposure time (bounded by the
 <a href="#controls_android.control.aeTargetFpsRange">android.<wbr/>control.<wbr/>ae<wbr/>Target<wbr/>Fps<wbr/>Range</a> when <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> is one of the
-ON_<wbr/>* modes) and effecitve max sensitivity are reached.<wbr/> This scene mode allows the
+ON_<wbr/>* modes) and effective max sensitivity are reached.<wbr/> This scene mode allows the
 camera device auto-exposure routine to increase the sensitivity up to the max
 sensitivity specified by <a href="#static_android.sensor.info.sensitivityRange">android.<wbr/>sensor.<wbr/>info.<wbr/>sensitivity<wbr/>Range</a> when the scene is too
 dark and the max exposure time is reached.<wbr/> The captured images may be noisier
-compared with the images captured in normal FACE_<wbr/>PRIORITY mode,<wbr/> therefore,<wbr/> it is
+compared with the images captured in normal FACE_<wbr/>PRIORITY mode; therefore,<wbr/> it is
 recommended that the application only use this scene mode when it is capable of
 reducing the noise level of the captured images.<wbr/></p>
 <p>Unlike the other scene modes,<wbr/> <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a>,<wbr/>
@@ -17508,7 +17508,7 @@
 <tbody>
 <tr>
 <td align="center"><a href="https://developer.android.com/reference/android/graphics/ImageFormat.html#JPEG">ImageFormat#JPEG</a></td>
-<td align="center"><a href="#static_android.sensor.info.activeArraySize">android.<wbr/>sensor.<wbr/>info.<wbr/>active<wbr/>Array<wbr/>Size</a></td>
+<td align="center"><a href="#static_android.sensor.info.activeArraySize">android.<wbr/>sensor.<wbr/>info.<wbr/>active<wbr/>Array<wbr/>Size</a> (*1)</td>
 <td align="center">Any</td>
 <td align="center"></td>
 </tr>
@@ -17520,7 +17520,7 @@
 </tr>
 <tr>
 <td align="center"><a href="https://developer.android.com/reference/android/graphics/ImageFormat.html#JPEG">ImageFormat#JPEG</a></td>
-<td align="center">1280x720 (720)</td>
+<td align="center">1280x720 (720p)</td>
 <td align="center">Any</td>
 <td align="center">if 720p &lt;= activeArraySize</td>
 </tr>
@@ -17558,6 +17558,22 @@
 </table>
 <p>Refer to <a href="#static_android.request.availableCapabilities">android.<wbr/>request.<wbr/>available<wbr/>Capabilities</a> and <a href="https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createCaptureSession">CameraDevice#createCaptureSession</a> for additional mandatory
 stream configurations on a per-capability basis.<wbr/></p>
+<p>*1: For JPEG format,<wbr/> the sizes may be restricted by below conditions:</p>
+<ul>
+<li>The HAL may choose the aspect ratio of each Jpeg size to be one of well known ones
+(e.<wbr/>g.<wbr/> 4:3,<wbr/> 16:9,<wbr/> 3:2 etc.<wbr/>).<wbr/> If the sensor maximum resolution
+(defined by <a href="#static_android.sensor.info.activeArraySize">android.<wbr/>sensor.<wbr/>info.<wbr/>active<wbr/>Array<wbr/>Size</a>) has an aspect ratio other than these,<wbr/>
+it does not have to be included in the supported JPEG sizes.<wbr/></li>
+<li>Some hardware JPEG encoders may have pixel boundary alignment requirements,<wbr/> such as
+the dimensions being a multiple of 16.<wbr/>
+Therefore,<wbr/> the maximum JPEG size may be smaller than sensor maximum resolution.<wbr/>
+However,<wbr/> the largest JPEG size will be as close as possible to the sensor maximum
+resolution given above constraints.<wbr/> It is required that after aspect ratio adjustments,<wbr/>
+additional size reduction due to other issues must be less than 3% in area.<wbr/> For example,<wbr/>
+if the sensor maximum resolution is 3280x2464,<wbr/> if the maximum JPEG size has aspect
+ratio 4:3,<wbr/> and the JPEG encoder alignment requirement is 16,<wbr/> the maximum JPEG size will be
+3264x2448.<wbr/></li>
+</ul>
             </td>
           </tr>
 
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index 83b039d..dae74e1 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -1713,22 +1713,22 @@
             </value>
             <value optional="true" hidden="true">FACE_PRIORITY_LOW_LIGHT
               <notes>Same as FACE_PRIORITY scene mode, except that the camera
-              device will choose higher sensivity values (android.sensor.sensitivity)
+              device will choose higher sensitivity values (android.sensor.sensitivity)
               under low light conditions.
 
               The camera device may be tuned to expose the images in a reduced
               sensitivity range to produce the best quality images. For example,
               if the android.sensor.info.sensitivityRange gives range of [100, 1600],
               the camera device auto-exposure routine tuning process may limit the actual
-              exposure sensivity range to [100, 1200] to ensure that the noise level isn't
-              exessive to compromise the image quality. Under this situation, the image under
+              exposure sensitivity range to [100, 1200] to ensure that the noise level isn't
+              exessive in order to preserve the image quality. Under this situation, the image under
               low light may be under-exposed when the sensor max exposure time (bounded by the
               android.control.aeTargetFpsRange when android.control.aeMode is one of the
-              ON_* modes) and effecitve max sensitivity are reached. This scene mode allows the
+              ON_* modes) and effective max sensitivity are reached. This scene mode allows the
               camera device auto-exposure routine to increase the sensitivity up to the max
               sensitivity specified by android.sensor.info.sensitivityRange when the scene is too
               dark and the max exposure time is reached. The captured images may be noisier
-              compared with the images captured in normal FACE_PRIORITY mode, therefore, it is
+              compared with the images captured in normal FACE_PRIORITY mode; therefore, it is
               recommended that the application only use this scene mode when it is capable of
               reducing the noise level of the captured images.
 
@@ -5656,9 +5656,9 @@
 
           Format                                             | Size                                         | Hardware Level | Notes
           :-------------------------------------------------:|:--------------------------------------------:|:--------------:|:--------------:
-          {@link android.graphics.ImageFormat#JPEG}          | android.sensor.info.activeArraySize          | Any            |
+          {@link android.graphics.ImageFormat#JPEG}          | android.sensor.info.activeArraySize (*1)     | Any            |
           {@link android.graphics.ImageFormat#JPEG}          | 1920x1080 (1080p)                            | Any            | if 1080p &lt;= activeArraySize
-          {@link android.graphics.ImageFormat#JPEG}          | 1280x720 (720)                               | Any            | if 720p &lt;= activeArraySize
+          {@link android.graphics.ImageFormat#JPEG}          | 1280x720 (720p)                               | Any            | if 720p &lt;= activeArraySize
           {@link android.graphics.ImageFormat#JPEG}          | 640x480 (480p)                               | Any            | if 480p &lt;= activeArraySize
           {@link android.graphics.ImageFormat#JPEG}          | 320x240 (240p)                               | Any            | if 240p &lt;= activeArraySize
           {@link android.graphics.ImageFormat#YUV_420_888}   | all output sizes available for JPEG          | FULL           |
@@ -5668,6 +5668,22 @@
           Refer to android.request.availableCapabilities and {@link
           android.hardware.camera2.CameraDevice#createCaptureSession} for additional mandatory
           stream configurations on a per-capability basis.
+
+          *1: For JPEG format, the sizes may be restricted by below conditions:
+
+          * The HAL may choose the aspect ratio of each Jpeg size to be one of well known ones
+          (e.g. 4:3, 16:9, 3:2 etc.). If the sensor maximum resolution
+          (defined by android.sensor.info.activeArraySize) has an aspect ratio other than these,
+          it does not have to be included in the supported JPEG sizes.
+          * Some hardware JPEG encoders may have pixel boundary alignment requirements, such as
+          the dimensions being a multiple of 16.
+          Therefore, the maximum JPEG size may be smaller than sensor maximum resolution.
+          However, the largest JPEG size will be as close as possible to the sensor maximum
+          resolution given above constraints. It is required that after aspect ratio adjustments,
+          additional size reduction due to other issues must be less than 3% in area. For example,
+          if the sensor maximum resolution is 3280x2464, if the maximum JPEG size has aspect
+          ratio 4:3, and the JPEG encoder alignment requirement is 16, the maximum JPEG size will be
+          3264x2448.
           </details>
           <hal_details>
           Do not set this property directly