Merge "Revert "add const qualifier to the pcm_mask variables and arguments"" am: b324437e6e

Original change: https://android-review.googlesource.com/c/platform/system/media/+/1519788

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52edf9920cbb8eb7feb2b0e362ec660f3260ac33
diff --git a/audio_utils/spdif/SPDIFEncoder.cpp b/audio_utils/spdif/SPDIFEncoder.cpp
index 4a8a02a..60b8425 100644
--- a/audio_utils/spdif/SPDIFEncoder.cpp
+++ b/audio_utils/spdif/SPDIFEncoder.cpp
@@ -140,6 +140,12 @@
         clearBurstBuffer();
         return;
     }
+
+    // Avoid reading first word past end of mBurstBuffer.
+    if (numBytes == 0) {
+        return;
+    }
+    // Pack bytes into short buffer.
     uint16_t pad = mBurstBuffer[mByteCursor >> 1];
     for (size_t i = 0; i < numBytes; i++) {
         if (mByteCursor & 1 ) {
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index bda9616..64b533a 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -4850,10 +4850,8 @@
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="6">
-              <p>Instead of using <a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> with dual purposes of crop and zoom,<wbr/> the
-application can now choose to use this tag to specify the desired zoom level.<wbr/> The
-<a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> can still be used to specify the horizontal or vertical
-crop to achieve aspect ratios different than the native camera sensor.<wbr/></p>
+              <p>Instead of using <a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> for zoom,<wbr/> the application can now choose to
+use this tag to specify the desired zoom level.<wbr/></p>
 <p>By using this control,<wbr/> the application gains a simpler way to control zoom,<wbr/> which can
 be a combination of optical and digital zoom.<wbr/> For example,<wbr/> a multi-camera system may
 contain more than one lens with different focal lengths,<wbr/> and the user can use optical
@@ -6636,12 +6634,11 @@
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="6">
-              <p>When the key is reported,<wbr/> the camera device must be setting
-<a href="#static_android.scaler.availableMaxDigitalZoom">android.<wbr/>scaler.<wbr/>available<wbr/>Max<wbr/>Digital<wbr/>Zoom</a> to be the same as maxZoom.<wbr/> The camera framework
-makes sure to always controls zoom via <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a>.<wbr/> The
-<a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> tag is only used to do horizontal or vertical cropping (but
-not both) to achieve aspect ratio different than the camera sensor's native aspect
-ratio.<wbr/></p>
+              <p>When the key is reported,<wbr/> the camera device's <a href="#static_android.scaler.availableMaxDigitalZoom">android.<wbr/>scaler.<wbr/>available<wbr/>Max<wbr/>Digital<wbr/>Zoom</a>
+must be less than or equal to maxZoom.<wbr/> The camera framework makes sure to always
+control zoom via <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a>.<wbr/> The <a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> tag is only
+used to do horizontal or vertical cropping (but not both) to achieve aspect ratio
+different than the camera sensor's native aspect ratio.<wbr/></p>
 <p>For a logical multi-camera device,<wbr/> this key must either be reported for both the logical
 camera device and all its physical sub-cameras,<wbr/> or none of them.<wbr/></p>
 <p>When the key is not reported,<wbr/> camera framework derives the application-facing
@@ -10487,10 +10484,8 @@
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="6">
-              <p>Instead of using <a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> with dual purposes of crop and zoom,<wbr/> the
-application can now choose to use this tag to specify the desired zoom level.<wbr/> The
-<a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> can still be used to specify the horizontal or vertical
-crop to achieve aspect ratios different than the native camera sensor.<wbr/></p>
+              <p>Instead of using <a href="#controls_android.scaler.cropRegion">android.<wbr/>scaler.<wbr/>crop<wbr/>Region</a> for zoom,<wbr/> the application can now choose to
+use this tag to specify the desired zoom level.<wbr/></p>
 <p>By using this control,<wbr/> the application gains a simpler way to control zoom,<wbr/> which can
 be a combination of optical and digital zoom.<wbr/> For example,<wbr/> a multi-camera system may
 contain more than one lens with different focal lengths,<wbr/> and the user can use optical
@@ -19652,11 +19647,18 @@
 respectively.<wbr/></p>
 <p>The camera device may adjust the crop region to account for rounding and other hardware
 requirements; the final crop region used will be included in the output capture result.<wbr/></p>
+<p>The camera sensor output aspect ratio depends on factors such as output stream
+combination and <a href="#controls_android.control.aeTargetFpsRange">android.<wbr/>control.<wbr/>ae<wbr/>Target<wbr/>Fps<wbr/>Range</a>,<wbr/> and shouldn't be adjusted by using
+this control.<wbr/> And the camera device will treat different camera sensor output sizes
+(potentially with in-sensor crop) as the same crop of
+<a href="#static_android.sensor.info.activeArraySize">android.<wbr/>sensor.<wbr/>info.<wbr/>active<wbr/>Array<wbr/>Size</a>.<wbr/> As a result,<wbr/> the application shouldn't assume the
+maximum crop region always maps to the same aspect ratio or field of view for the
+sensor output.<wbr/></p>
 <p>Starting from API level 30,<wbr/> it's strongly recommended to use <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a>
 to take advantage of better support for zoom with logical multi-camera.<wbr/> The benefits
 include better precision with optical-digital zoom combination,<wbr/> and ability to do
 zoom-out from 1.<wbr/>0x.<wbr/> When using <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a> for zoom,<wbr/> the crop region in
-the capture request must be either letterboxing or pillarboxing (but not both).<wbr/> The
+the capture request should be left as the default activeArray size.<wbr/> The
 coordinate system is post-zoom,<wbr/> meaning that the activeArraySize or
 preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.<wbr/>  See
 <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a> for details.<wbr/></p>
@@ -22024,11 +22026,18 @@
 respectively.<wbr/></p>
 <p>The camera device may adjust the crop region to account for rounding and other hardware
 requirements; the final crop region used will be included in the output capture result.<wbr/></p>
+<p>The camera sensor output aspect ratio depends on factors such as output stream
+combination and <a href="#controls_android.control.aeTargetFpsRange">android.<wbr/>control.<wbr/>ae<wbr/>Target<wbr/>Fps<wbr/>Range</a>,<wbr/> and shouldn't be adjusted by using
+this control.<wbr/> And the camera device will treat different camera sensor output sizes
+(potentially with in-sensor crop) as the same crop of
+<a href="#static_android.sensor.info.activeArraySize">android.<wbr/>sensor.<wbr/>info.<wbr/>active<wbr/>Array<wbr/>Size</a>.<wbr/> As a result,<wbr/> the application shouldn't assume the
+maximum crop region always maps to the same aspect ratio or field of view for the
+sensor output.<wbr/></p>
 <p>Starting from API level 30,<wbr/> it's strongly recommended to use <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a>
 to take advantage of better support for zoom with logical multi-camera.<wbr/> The benefits
 include better precision with optical-digital zoom combination,<wbr/> and ability to do
 zoom-out from 1.<wbr/>0x.<wbr/> When using <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a> for zoom,<wbr/> the crop region in
-the capture request must be either letterboxing or pillarboxing (but not both).<wbr/> The
+the capture request should be left as the default activeArray size.<wbr/> The
 coordinate system is post-zoom,<wbr/> meaning that the activeArraySize or
 preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.<wbr/>  See
 <a href="#controls_android.control.zoomRatio">android.<wbr/>control.<wbr/>zoom<wbr/>Ratio</a> for details.<wbr/></p>
diff --git a/camera/docs/metadata_definitions.xml b/camera/docs/metadata_definitions.xml
index ca35e8d..965bc75 100644
--- a/camera/docs/metadata_definitions.xml
+++ b/camera/docs/metadata_definitions.xml
@@ -3239,12 +3239,11 @@
             of view.
           </details>
           <hal_details>
-            When the key is reported, the camera device must be setting
-            android.scaler.availableMaxDigitalZoom to be the same as maxZoom. The camera framework
-            makes sure to always controls zoom via android.control.zoomRatio. The
-            android.scaler.cropRegion tag is only used to do horizontal or vertical cropping (but
-            not both) to achieve aspect ratio different than the camera sensor's native aspect
-            ratio.
+            When the key is reported, the camera device's android.scaler.availableMaxDigitalZoom
+            must be less than or equal to maxZoom. The camera framework makes sure to always
+            control zoom via android.control.zoomRatio. The android.scaler.cropRegion tag is only
+            used to do horizontal or vertical cropping (but not both) to achieve aspect ratio
+            different than the camera sensor's native aspect ratio.
 
             For a logical multi-camera device, this key must either be reported for both the logical
             camera device and all its physical sub-cameras, or none of them.
@@ -3262,10 +3261,8 @@
           </description>
           <range>android.control.zoomRatioRange</range>
           <details>
-            Instead of using android.scaler.cropRegion with dual purposes of crop and zoom, the
-            application can now choose to use this tag to specify the desired zoom level. The
-            android.scaler.cropRegion can still be used to specify the horizontal or vertical
-            crop to achieve aspect ratios different than the native camera sensor.
+            Instead of using android.scaler.cropRegion for zoom, the application can now choose to
+            use this tag to specify the desired zoom level.
 
             By using this control, the application gains a simpler way to control zoom, which can
             be a combination of optical and digital zoom. For example, a multi-camera system may
@@ -6374,11 +6371,19 @@
             The camera device may adjust the crop region to account for rounding and other hardware
             requirements; the final crop region used will be included in the output capture result.
 
+            The camera sensor output aspect ratio depends on factors such as output stream
+            combination and android.control.aeTargetFpsRange, and shouldn't be adjusted by using
+            this control. And the camera device will treat different camera sensor output sizes
+            (potentially with in-sensor crop) as the same crop of
+            android.sensor.info.activeArraySize. As a result, the application shouldn't assume the
+            maximum crop region always maps to the same aspect ratio or field of view for the
+            sensor output.
+
             Starting from API level 30, it's strongly recommended to use android.control.zoomRatio
             to take advantage of better support for zoom with logical multi-camera. The benefits
             include better precision with optical-digital zoom combination, and ability to do
             zoom-out from 1.0x. When using android.control.zoomRatio for zoom, the crop region in
-            the capture request must be either letterboxing or pillarboxing (but not both). The
+            the capture request should be left as the default activeArray size. The
             coordinate system is post-zoom, meaning that the activeArraySize or
             preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.  See
             android.control.zoomRatio for details.