camera_metadata: update jpeg thumbnail related specs

Below tags are updated:
- android.jpeg.thumbnailSize
- android.jpeg.availableThumbnailSizes

Bug: 12135317
Change-Id: I8dc9122fd009051d5b83de3d8c14fc4903ade3c5
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index ffeae0f..b0724ee 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -4723,18 +4723,21 @@
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <html><body><p>Resolution of embedded JPEG
-thumbnail<wbr></wbr></p></body></html>
+              <html><body><p>Resolution of embedded JPEG thumbnail<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_units">
             </td>
 
             <td class="entry_range">
-              <html><body><p>from android.jpeg.availableThumbnailSizes<wbr></wbr></p></body></html>
+              <html><body><p>Size must be one of the size from android.jpeg.availableThumbnailSizes<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_notes">
+              <html><body><p>When set to (0, 0) value, the JPEG EXIF must not contain thumbnail,
+but the captured JPEG must still be a valid image.</p>
+<p>When a jpeg image capture is issued, the thumbnail size selected should have
+the same aspect ratio as the jpeg image.<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_tags">
@@ -4784,14 +4787,12 @@
                   2 x n
                 </span>
               <span class="entry_type_visibility"> [public as size]</span>
-                <div class="entry_type_notes"><html><body><p>list of resolution pairs<wbr></wbr></p></body></html></div>
 
 
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <html><body><p>Supported resolutions for the JPEG
-thumbnail<wbr></wbr></p></body></html>
+              <html><body><p>Supported resolutions for the JPEG thumbnail<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_units">
@@ -4799,10 +4800,23 @@
 
             <td class="entry_range">
               <html><body><p>Must include at least one valid resolution, plus
-          (0,0) for no thumbnail generation<wbr></wbr></p></body></html>
+          (0,0) for no thumbnail generation, and each size must be distinct.<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_notes">
+              <html><body><p>Below condiditions must be satisfied for this size list:</p>
+<ul>
+<li>The sizes must be sorted by increasing pixel area (width x height).
+If several resolutions have the same area, they must be sorted by increasing width.</li>
+<li>The aspect ratio of the largest thumbnail size must be same as the
+aspect ratio of largest size in android.scaler.availableJpegSizes.
+The largest size is defined as the size that has the largest pixel area
+in a given size list.</li>
+<li>Each size in android.scaler.availableJpegSizes must have at least
+one corresponding size that has the same aspect ratio in availableThumbnailSizes,
+and vice versa.</li>
+<li>All non (0, 0) sizes must have non-zero widths and heights.</li>
+<wbr></wbr></ul></body></html>
             </td>
 
             <td class="entry_tags">
@@ -5141,18 +5155,21 @@
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <html><body><p>Resolution of embedded JPEG
-thumbnail<wbr></wbr></p></body></html>
+              <html><body><p>Resolution of embedded JPEG thumbnail<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_units">
             </td>
 
             <td class="entry_range">
-              <html><body><p>from android.jpeg.availableThumbnailSizes<wbr></wbr></p></body></html>
+              <html><body><p>Size must be one of the size from android.jpeg.availableThumbnailSizes<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_notes">
+              <html><body><p>When set to (0, 0) value, the JPEG EXIF must not contain thumbnail,
+but the captured JPEG must still be a valid image.</p>
+<p>When a jpeg image capture is issued, the thumbnail size selected should have
+the same aspect ratio as the jpeg image.<wbr></wbr></p></body></html>
             </td>
 
             <td class="entry_tags">
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index 2848590..bc2a208 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -1142,23 +1142,38 @@
           <array>
             <size>2</size>
           </array>
-          <description>Resolution of embedded JPEG
-          thumbnail</description>
-          <range>from android.jpeg.availableThumbnailSizes</range>
+          <description>Resolution of embedded JPEG thumbnail</description>
+          <range>Size must be one of the size from android.jpeg.availableThumbnailSizes</range>
+          <notes>When set to (0, 0) value, the JPEG EXIF must not contain thumbnail,
+          but the captured JPEG must still be a valid image.
+
+          When a jpeg image capture is issued, the thumbnail size selected should have
+          the same aspect ratio as the jpeg image.</notes>
           <tag id="BC" />
         </entry>
       </controls>
       <static>
         <entry name="availableThumbnailSizes" type="int32" visibility="public"
-        type_notes="list of resolution pairs" container="array" typedef="size">
+        container="array" typedef="size">
           <array>
             <size>2</size>
             <size>n</size>
           </array>
-          <description>Supported resolutions for the JPEG
-          thumbnail</description>
+          <description>Supported resolutions for the JPEG thumbnail</description>
           <range>Must include at least one valid resolution, plus
-          (0,0) for no thumbnail generation</range>
+          (0,0) for no thumbnail generation, and each size must be distinct.</range>
+          <notes>Below condiditions must be satisfied for this size list:
+
+          * The sizes must be sorted by increasing pixel area (width x height).
+          If several resolutions have the same area, they must be sorted by increasing width.
+          * The aspect ratio of the largest thumbnail size must be same as the
+          aspect ratio of largest size in android.scaler.availableJpegSizes.
+          The largest size is defined as the size that has the largest pixel area
+          in a given size list.
+          * Each size in android.scaler.availableJpegSizes must have at least
+          one corresponding size that has the same aspect ratio in availableThumbnailSizes,
+          and vice versa.
+          * All non (0, 0) sizes must have non-zero widths and heights.</notes>
           <tag id="BC" />
         </entry>
         <entry name="maxSize" type="int32" visibility="system">