Merge tag android-5.1.0_r1 into AOSP_5.1_MERGE

Change-Id: Id1ea3859324f1f1bfe51db50a8a34dcea38f9f30
diff --git a/audio_utils/include/audio_utils/spdif/FrameScanner.h b/audio_utils/include/audio_utils/spdif/FrameScanner.h
index f1f2cd1..ff245e4 100644
--- a/audio_utils/include/audio_utils/spdif/FrameScanner.h
+++ b/audio_utils/include/audio_utils/spdif/FrameScanner.h
@@ -74,13 +74,10 @@
     virtual int getDataType()      const { return mDataType; }
     virtual int getDataTypeInfo()  const { return mDataTypeInfo; }
 
-    /**
-     * lengthCode is defined by the SPDIF standard
-     * @return length of the frame in bits or bytes, depending on the format.
-     */
-    virtual int getLengthCode()  const = 0;
     virtual int getMaxChannels() const = 0;
 
+    virtual void resetBurst() = 0;
+
     /**
      * @return the number of pcm frames that correspond to one encoded frame
      */
@@ -113,6 +110,7 @@
 #define EAC3_RATE_MULTIPLIER                       4
 #define EAC3_NUM_SAMPLE_RATE_TABLE_ENTRIES         3
 #define EAC3_NUM_BLOCKS_PER_FRAME_TABLE_ENTRIES   38
+#define EAC3_MAX_SUBSTREAMS                        8
 
 class AC3FrameScanner : public FrameScanner
 {
@@ -127,7 +125,6 @@
 
     virtual int getDataType()      const { return mDataType; }
     virtual int getDataTypeInfo()  const { return 0; }
-    virtual int getLengthCode()    const { return mLengthCode; }
     virtual int getMaxChannels()   const { return 5 + 1; }
 
     virtual int getMaxSampleFramesPerSyncFrame() const { return EAC3_RATE_MULTIPLIER
@@ -136,6 +133,7 @@
 
     virtual bool isFirstInBurst();
     virtual bool isLastInBurst();
+    virtual void resetBurst();
 
 protected:
 
@@ -152,7 +150,7 @@
     State    mState;
     uint32_t mBytesSkipped;
     uint8_t  mHeaderBuffer[6];
-    int      mLengthCode;
+    uint8_t  mSubstreamBlockCounts[EAC3_MAX_SUBSTREAMS];
     int      mAudioBlocksPerSyncFrame;
     uint     mCursor;
     uint     mStreamType;
diff --git a/audio_utils/include/audio_utils/spdif/SPDIFEncoder.h b/audio_utils/include/audio_utils/spdif/SPDIFEncoder.h
index 24b6074..b880a93 100644
--- a/audio_utils/include/audio_utils/spdif/SPDIFEncoder.h
+++ b/audio_utils/include/audio_utils/spdif/SPDIFEncoder.h
@@ -37,14 +37,22 @@
     SPDIFEncoder();
     virtual ~SPDIFEncoder();
 
+    // Write encoded data to be wrapped for SPDIF.
+    // The compressed frames do not have to be aligned.
     ssize_t write( const void* buffer, size_t numBytes );
 
     // Called by SPDIFEncoder when it is ready to output a data burst.
     // Must be implemented by caller.
     virtual ssize_t writeOutput( const void* buffer, size_t numBytes ) = 0;
 
+    // Get ration of the encoded data burst sample rate to the encoded rate.
+    // For example, EAC3 data bursts are 4X the encoded rate.
     uint32_t getRateMultiplier() const { return mRateMultiplier; }
+
+    // Return the number of PCM frames in a data burst.
     uint32_t getBurstFrames() const { return mBurstFrames; }
+
+    // Return number of bytes per PCM frame for the data burst.
     int      getBytesPerOutputFrame();
 
 protected:
@@ -54,7 +62,8 @@
     void   writeBurstBufferBytes(const uint8_t* buffer, size_t numBytes);
     void   sendZeroPad();
     void   flushBurstBuffer();
-    size_t startDataBurst();
+    void   startDataBurst();
+    size_t startSyncFrame();
 
     // State machine states.
     enum State {
diff --git a/audio_utils/spdif/FrameScanner.cpp b/audio_utils/spdif/FrameScanner.cpp
index f12e538..5a6e21f 100644
--- a/audio_utils/spdif/FrameScanner.cpp
+++ b/audio_utils/spdif/FrameScanner.cpp
@@ -15,7 +15,7 @@
 ** limitations under the License.
 */
 
-#define LOG_TAG "AudioHardwareTungsten"
+#define LOG_TAG "AudioSPDIF"
 
 #include <utils/Log.h>
 #include <audio_utils/spdif/FrameScanner.h>
@@ -104,13 +104,13 @@
  : FrameScanner(SPDIF_DATA_TYPE_AC3)
  , mState(STATE_EXPECTING_SYNC_1)
  , mBytesSkipped(0)
- , mLengthCode(0)
  , mAudioBlocksPerSyncFrame(6)
  , mCursor(AC3_SYNCWORD_SIZE) // past sync word
  , mStreamType(0)
  , mSubstreamID(0)
  , mFormatDumpCount(0)
 {
+    memset(mSubstreamBlockCounts, 0, sizeof(mSubstreamBlockCounts));
     // Define beginning of syncinfo for getSyncAddress()
     mHeaderBuffer[0] = kAC3SyncByte1;
     mHeaderBuffer[1] = kAC3SyncByte2;
@@ -125,14 +125,36 @@
     return mRateMultiplier * AC3_MAX_BLOCKS_PER_SYNC_FRAME_BLOCK * AC3_PCM_FRAMES_PER_BLOCK;
 }
 
+void AC3FrameScanner::resetBurst()
+{
+    for (int i = 0; i < EAC3_MAX_SUBSTREAMS; i++) {
+        if (mSubstreamBlockCounts[i] >= AC3_MAX_BLOCKS_PER_SYNC_FRAME_BLOCK) {
+            mSubstreamBlockCounts[i] -= AC3_MAX_BLOCKS_PER_SYNC_FRAME_BLOCK;
+        } else if (mSubstreamBlockCounts[i] > 0) {
+            ALOGW("EAC3 substream[%d] has only %d audio blocks!",
+                i, mSubstreamBlockCounts[i]);
+            mSubstreamBlockCounts[i] = 0;
+        }
+    }
+}
+
 // per IEC 61973-3 Paragraph 5.3.3
+// We have to send 6 audio blocks on all active substreams.
+// Substream zero must be the first.
+// We don't know if we have all the blocks we need until we see
+// the 7th block of substream#0.
 bool AC3FrameScanner::isFirstInBurst()
 {
     if (mDataType == SPDIF_DATA_TYPE_E_AC3) {
-        return (((mStreamType == 0) || (mStreamType == 2)) && (mSubstreamID == 0));
-    } else {
-        return false; // For AC3 just flush at end.
+        if (((mStreamType == 0) || (mStreamType == 2))
+            && (mSubstreamID == 0)
+            // The ">" is intentional. We have to see the beginning of the block
+            // in the next burst before we can send the current burst.
+            && (mSubstreamBlockCounts[0] > AC3_MAX_BLOCKS_PER_SYNC_FRAME_BLOCK)) {
+            return true;
+        }
     }
+    return false;
 }
 
 bool AC3FrameScanner::isLastInBurst()
@@ -165,14 +187,9 @@
     // The names fscod, frmsiz are from the AC3 spec.
     int fscod = mHeaderBuffer[4] >> 6;
     if (mDataType == SPDIF_DATA_TYPE_E_AC3) {
-        mStreamType = mHeaderBuffer[2] >> 6;
+        mStreamType = mHeaderBuffer[2] >> 6; // strmtyp in spec
         mSubstreamID = (mHeaderBuffer[2] >> 3) & 0x07;
 
-        // Print enough so we can see all the substreams.
-        ALOGD_IF((mFormatDumpCount < 3*8 ),
-                "EAC3 strmtyp = %d, substreamid = %d",
-                mStreamType, mSubstreamID);
-
         // Frame size is explicit in EAC3. Paragraph E2.3.1.3
         int frmsiz = ((mHeaderBuffer[2] & 0x07) << 8) + mHeaderBuffer[3];
         mFrameSizeBytes = (frmsiz + 1) * sizeof(int16_t);
@@ -191,8 +208,17 @@
             numblkscod = (mHeaderBuffer[4] >> 4) & 0x03;
         }
         mRateMultiplier = EAC3_RATE_MULTIPLIER; // per IEC 61973-3 Paragraph 5.3.3
-        // TODO Don't send data burst until we have 6 blocks per substream.
+        // Don't send data burst until we have 6 blocks per substream.
         mAudioBlocksPerSyncFrame = kEAC3BlocksPerFrameTable[numblkscod];
+        // Keep track of how many audio blocks we have for each substream.
+        // This should be safe because mSubstreamID is ANDed with 0x07 above.
+        // And the array is allocated as [8].
+        mSubstreamBlockCounts[mSubstreamID] += mAudioBlocksPerSyncFrame;
+
+        // Print enough so we can see all the substreams.
+        ALOGD_IF((mFormatDumpCount < 3*8 ),
+                "EAC3 mStreamType = %d, mSubstreamID = %d",
+                mStreamType, mSubstreamID);
     } else { // regular AC3
         // Extract sample rate and frame size from codes.
         unsigned int frmsizcod = mHeaderBuffer[4] & 0x3F; // frame size code
@@ -211,7 +237,6 @@
         }
         mAudioBlocksPerSyncFrame = 6;
     }
-    mLengthCode = 8 * mFrameSizeBytes; // size in bits
     ALOGI_IF((mFormatDumpCount == 0),
             "AC3 frame rate = %d * %d, size = %d, audioBlocksPerSyncFrame = %d\n",
             mSampleRate, mRateMultiplier, mFrameSizeBytes, mAudioBlocksPerSyncFrame);
diff --git a/audio_utils/spdif/SPDIFEncoder.cpp b/audio_utils/spdif/SPDIFEncoder.cpp
index 07a1800..df39f14 100644
--- a/audio_utils/spdif/SPDIFEncoder.cpp
+++ b/audio_utils/spdif/SPDIFEncoder.cpp
@@ -18,7 +18,7 @@
 
 #include <stdint.h>
 
-#define LOG_TAG "AudioHardwareTungsten"
+#define LOG_TAG "AudioSPDIF"
 #include <utils/Log.h>
 #include <audio_utils/spdif/SPDIFEncoder.h>
 
@@ -48,8 +48,9 @@
     mBurstBufferSizeBytes = sizeof(uint16_t)
             * SPDIF_ENCODED_CHANNEL_COUNT
             * mFramer->getMaxSampleFramesPerSyncFrame();
+
     ALOGI("SPDIFEncoder: mBurstBufferSizeBytes = %d, littleEndian = %d",
-        mBurstBufferSizeBytes, isLittleEndian());
+            mBurstBufferSizeBytes, isLittleEndian());
     mBurstBuffer = new uint16_t[mBurstBufferSizeBytes >> 1];
     clearBurstBuffer();
 }
@@ -116,22 +117,29 @@
     size_t burstSize = mFramer->getSampleFramesPerSyncFrame() * sizeof(uint16_t)
             * SPDIF_ENCODED_CHANNEL_COUNT;
     if (mByteCursor > burstSize) {
-        ALOGE("SPDIFEncoder: Burst buffer, contents too large!\n");
+        ALOGE("SPDIFEncoder: Burst buffer, contents too large!");
         clearBurstBuffer();
     } else {
         // We don't have to write zeros because buffer already set to zero
-        // by clearBurstBuffer().
+        // by clearBurstBuffer(). Just pretend we wrote zeros by
+        // incrementing cursor.
         mByteCursor = burstSize;
     }
 }
 
 void SPDIFEncoder::flushBurstBuffer()
 {
-    if (mByteCursor > 0) {
+    const int preambleSize = 4 * sizeof(uint16_t);
+    if (mByteCursor > preambleSize) {
+        // Set number of bits for valid payload before zeroPad.
+        uint16_t lengthCode = (mByteCursor - preambleSize) * 8;
+        mBurstBuffer[3] = lengthCode;
+
         sendZeroPad();
         writeOutput(mBurstBuffer, mByteCursor);
-        clearBurstBuffer();
     }
+    clearBurstBuffer();
+    mFramer->resetBurst();
 }
 
 void SPDIFEncoder::clearBurstBuffer()
@@ -142,7 +150,7 @@
     mByteCursor = 0;
 }
 
-size_t SPDIFEncoder::startDataBurst()
+void SPDIFEncoder::startDataBurst()
 {
     // Encode IEC61937-1 Burst Preamble
     uint16_t preamble[4];
@@ -156,14 +164,15 @@
     preamble[0] = kSPDIFSync1;
     preamble[1] = kSPDIFSync2;
     preamble[2] = burstInfo;
-    preamble[3] = mFramer->getLengthCode();
+    preamble[3] = 0; // lengthCode - This will get set after the buffer is full.
     writeBurstBufferShorts(preamble, 4);
+}
 
+size_t SPDIFEncoder::startSyncFrame()
+{
     // Write start of encoded frame that was buffered in frame detector.
     size_t syncSize = mFramer->getHeaderSizeBytes();
     writeBurstBufferBytes(mFramer->getHeaderAddress(), syncSize);
-    ALOGV("SPDIFEncoder: startDataBurst, syncSize = %u, lengthCode = %d",
-        syncSize, mFramer->getLengthCode());
     return mFramer->getFrameSizeBytes() - syncSize;
 }
 
@@ -177,14 +186,17 @@
     while (bytesLeft > 0) {
         State nextState = mState;
         switch (mState) {
-        // Look for beginning of encoded frame.
+        // Look for beginning of next encoded frame.
         case STATE_IDLE:
             if (mFramer->scan(*data)) {
-                if (mFramer->isFirstInBurst()) {
+                if (mByteCursor == 0) {
+                    startDataBurst();
+                } else if (mFramer->isFirstInBurst()) {
                     // Make sure that this frame is at the beginning of the data burst.
                     flushBurstBuffer();
+                    startDataBurst();
                 }
-                mPayloadBytesPending = startDataBurst();
+                mPayloadBytesPending = startSyncFrame();
                 nextState = STATE_BURST;
             }
             data++;
@@ -208,7 +220,6 @@
                 // If we have all the payload then send a data burst.
                 if (mPayloadBytesPending == 0) {
                     if (mFramer->isLastInBurst()) {
-                        // Flush now if we know the burst is ready.
                         flushBurstBuffer();
                     }
                     nextState = STATE_IDLE;
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index c9ae10f..0674494 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -1833,9 +1833,9 @@
             <td class="entry_details" colspan="5">
               <p>This key lists the valid modes for <a href="#controls_android.colorCorrection.aberrationMode">android.<wbr/>color<wbr/>Correction.<wbr/>aberration<wbr/>Mode</a>.<wbr/>  If no
 aberration correction modes are available for a device,<wbr/> this list will solely include
-OFF mode.<wbr/></p>
-<p>For FULL capability device (<a href="#static_android.info.supportedHardwareLevel">android.<wbr/>info.<wbr/>supported<wbr/>Hardware<wbr/>Level</a> <code>==</code> FULL),<wbr/> OFF is
-always included.<wbr/></p>
+OFF mode.<wbr/> All camera devices will support either OFF or FAST mode.<wbr/></p>
+<p>Camera devices that support the MANUAL_<wbr/>POST_<wbr/>PROCESSING capability will always list
+OFF mode.<wbr/> This includes all FULL level devices.<wbr/></p>
 <p>LEGACY devices will always only support FAST mode.<wbr/></p>
             </td>
           </tr>
@@ -1913,7 +1913,8 @@
                     <span class="entry_type_enum_name">AUTO</span>
                     <span class="entry_type_enum_notes"><p>The camera device will automatically adapt its
 antibanding routine to the current illumination
-conditions.<wbr/> This is the default.<wbr/></p></span>
+condition.<wbr/> This is the default mode if AUTO is
+available on given camera device.<wbr/></p></span>
                   </li>
                 </ul>
 
@@ -1962,8 +1963,10 @@
 options for the antibanding mode.<wbr/> The
 <a href="#static_android.control.aeAvailableAntibandingModes">android.<wbr/>control.<wbr/>ae<wbr/>Available<wbr/>Antibanding<wbr/>Modes</a> key contains
 the available modes for a given camera device.<wbr/></p>
-<p>The default mode is AUTO,<wbr/> which is supported by all
-camera devices.<wbr/></p>
+<p>AUTO mode is the default if it is available on given
+camera device.<wbr/> When AUTO mode is not available,<wbr/> the
+default will be either 50HZ or 60HZ,<wbr/> and both 50HZ
+and 60HZ will be available.<wbr/></p>
 <p>If manual exposure control is enabled (by setting
 <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> or <a href="#controls_android.control.mode">android.<wbr/>control.<wbr/>mode</a> to OFF),<wbr/>
 then this setting has no effect,<wbr/> and the application must
@@ -1979,8 +1982,9 @@
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
               <p>For all capture request templates,<wbr/> this field must be set
-to AUTO.<wbr/>  AUTO is the only mode that must supported;
-OFF,<wbr/> 50HZ,<wbr/> 60HZ are all optional.<wbr/></p>
+to AUTO if AUTO mode is available.<wbr/> If AUTO is not available,<wbr/>
+the default must be either 50HZ or 60HZ,<wbr/> and both 50HZ and
+60HZ must be available.<wbr/></p>
 <p>If manual exposure control is enabled (by setting
 <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> or <a href="#controls_android.control.mode">android.<wbr/>control.<wbr/>mode</a> to OFF),<wbr/>
 then the exposure values provided by the application must not be
@@ -2175,6 +2179,14 @@
 <a href="#controls_android.sensor.frameDuration">android.<wbr/>sensor.<wbr/>frame<wbr/>Duration</a> are used by the camera
 device,<wbr/> along with android.<wbr/>flash.<wbr/>* fields,<wbr/> if there's
 a flash unit for this camera device.<wbr/></p>
+<p>Note that auto-white balance (AWB) and auto-focus (AF)
+behavior is device dependent when AE is in OFF mode.<wbr/>
+To have consistent behavior across different devices,<wbr/>
+it is recommended to either set AWB and AF to OFF mode
+or lock AWB and AF before setting AE to OFF.<wbr/>
+See <a href="#controls_android.control.awbMode">android.<wbr/>control.<wbr/>awb<wbr/>Mode</a>,<wbr/> <a href="#controls_android.control.afMode">android.<wbr/>control.<wbr/>af<wbr/>Mode</a>,<wbr/>
+<a href="#controls_android.control.awbLock">android.<wbr/>control.<wbr/>awb<wbr/>Lock</a>,<wbr/> and <a href="#controls_android.control.afTrigger">android.<wbr/>control.<wbr/>af<wbr/>Trigger</a>
+for more details.<wbr/></p>
 <p>LEGACY devices do not support the OFF mode and will
 override attempts to use this value to ON.<wbr/></p></span>
                   </li>
@@ -2479,9 +2491,9 @@
             <td class="entry_details" colspan="5">
               <p>This entry is normally set to IDLE,<wbr/> or is not
 included at all in the request settings.<wbr/> When included and
-set to START,<wbr/> the camera device will trigger the autoexposure
+set to START,<wbr/> the camera device will trigger the auto-exposure (AE)
 precapture metering sequence.<wbr/></p>
-<p>The precapture sequence should triggered before starting a
+<p>The precapture sequence should be triggered before starting a
 high-quality still capture for final metering decisions to
 be made,<wbr/> and for firing pre-capture flash pulses to estimate
 scene brightness and required final capture flash power,<wbr/> when
@@ -2489,6 +2501,14 @@
 <p>Normally,<wbr/> this entry should be set to START for only a
 single request,<wbr/> and the application should wait until the
 sequence completes before starting a new one.<wbr/></p>
+<p>When a precapture metering sequence is finished,<wbr/> the camera device
+may lock the auto-exposure routine internally to be able to accurately expose the
+subsequent still capture image (<code><a href="#controls_android.control.captureIntent">android.<wbr/>control.<wbr/>capture<wbr/>Intent</a> == STILL_<wbr/>CAPTURE</code>).<wbr/>
+For this case,<wbr/> the AE may not resume normal scan if no subsequent still capture is
+submitted.<wbr/> To ensure that the AE routine restarts normal scan,<wbr/> the application should
+submit a request with <code><a href="#controls_android.control.aeLock">android.<wbr/>control.<wbr/>ae<wbr/>Lock</a> == true</code>,<wbr/> followed by a request
+with <code><a href="#controls_android.control.aeLock">android.<wbr/>control.<wbr/>ae<wbr/>Lock</a> == false</code>,<wbr/> if the application decides not to submit a
+still capture request after the precapture sequence completes.<wbr/></p>
 <p>The exact effect of auto-exposure (AE) precapture trigger
 depends on the current AE mode and state; see
 <a href="#dynamic_android.control.aeState">android.<wbr/>control.<wbr/>ae<wbr/>State</a> for AE precapture state transition
@@ -2632,7 +2652,10 @@
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
               <p>Only effective if <a href="#controls_android.control.mode">android.<wbr/>control.<wbr/>mode</a> = AUTO and the lens is not fixed focus
-(i.<wbr/>e.<wbr/> <code><a href="#static_android.lens.info.minimumFocusDistance">android.<wbr/>lens.<wbr/>info.<wbr/>minimum<wbr/>Focus<wbr/>Distance</a> &gt; 0</code>).<wbr/></p>
+(i.<wbr/>e.<wbr/> <code><a href="#static_android.lens.info.minimumFocusDistance">android.<wbr/>lens.<wbr/>info.<wbr/>minimum<wbr/>Focus<wbr/>Distance</a> &gt; 0</code>).<wbr/> Also note that
+when <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> is OFF,<wbr/> the behavior of AF is device
+dependent.<wbr/> It is recommended to lock AF by using <a href="#controls_android.control.afTrigger">android.<wbr/>control.<wbr/>af<wbr/>Trigger</a> before
+setting <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> to OFF,<wbr/> or set AF mode to OFF when AE is OFF.<wbr/></p>
 <p>If the lens is controlled by the camera device auto-focus algorithm,<wbr/>
 the camera device will report the current AF status in <a href="#dynamic_android.control.afState">android.<wbr/>control.<wbr/>af<wbr/>State</a>
 in result metadata.<wbr/></p>
@@ -3073,7 +3096,10 @@
 <p>When set to the ON mode,<wbr/> the camera device's auto-white balance
 routine is enabled,<wbr/> overriding the application's selected
 <a href="#controls_android.colorCorrection.transform">android.<wbr/>color<wbr/>Correction.<wbr/>transform</a>,<wbr/> <a href="#controls_android.colorCorrection.gains">android.<wbr/>color<wbr/>Correction.<wbr/>gains</a> and
-<a href="#controls_android.colorCorrection.mode">android.<wbr/>color<wbr/>Correction.<wbr/>mode</a>.<wbr/></p>
+<a href="#controls_android.colorCorrection.mode">android.<wbr/>color<wbr/>Correction.<wbr/>mode</a>.<wbr/> Note that when <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a>
+is OFF,<wbr/> the behavior of AWB is device dependent.<wbr/> It is recommened to
+also set AWB mode to OFF or lock AWB by using <a href="#controls_android.control.awbLock">android.<wbr/>control.<wbr/>awb<wbr/>Lock</a> before
+setting AE mode to OFF.<wbr/></p>
 <p>When set to the OFF mode,<wbr/> the camera device's auto-white balance
 routine is disabled.<wbr/> The application manually controls the white
 balance by <a href="#controls_android.colorCorrection.transform">android.<wbr/>color<wbr/>Correction.<wbr/>transform</a>,<wbr/> <a href="#controls_android.colorCorrection.gains">android.<wbr/>color<wbr/>Correction.<wbr/>gains</a>
@@ -3695,10 +3721,38 @@
                   <li>
                     <span class="entry_type_enum_name">HDR</span>
                     <span class="entry_type_enum_optional">[optional]</span>
-                    <span class="entry_type_enum_optional">[hidden]</span>
-                    <span class="entry_type_enum_notes"><p>Turn on custom high dynamic range (HDR) mode.<wbr/></p>
-<p>This is intended for LEGACY mode devices only;
-HAL3+ camera devices should not implement this mode.<wbr/></p></span>
+                    <span class="entry_type_enum_notes"><p>Turn on a device-specific high dynamic range (HDR) mode.<wbr/></p>
+<p>In this scene mode,<wbr/> the camera device captures images
+that keep a larger range of scene illumination levels
+visible in the final image.<wbr/> For example,<wbr/> when taking a
+picture of a object in front of a bright window,<wbr/> both
+the object and the scene through the window may be
+visible when using HDR mode,<wbr/> while in normal AUTO mode,<wbr/>
+one or the other may be poorly exposed.<wbr/> As a tradeoff,<wbr/>
+HDR mode generally takes much longer to capture a single
+image,<wbr/> has no user control,<wbr/> and may have other artifacts
+depending on the HDR method used.<wbr/></p>
+<p>Therefore,<wbr/> HDR captures operate at a much slower rate
+than regular captures.<wbr/></p>
+<p>In this mode,<wbr/> on LIMITED or FULL devices,<wbr/> when a request
+is made with a <a href="#controls_android.control.captureIntent">android.<wbr/>control.<wbr/>capture<wbr/>Intent</a> of
+STILL_<wbr/>CAPTURE,<wbr/> the camera device will capture an image
+using a high dynamic range capture technique.<wbr/>  On LEGACY
+devices,<wbr/> captures that target a JPEG-format output will
+be captured with HDR,<wbr/> and the capture intent is not
+relevant.<wbr/></p>
+<p>The HDR capture may involve the device capturing a burst
+of images internally and combining them into one,<wbr/> or it
+may involve the device using specialized high dynamic
+range capture hardware.<wbr/> In all cases,<wbr/> a single image is
+produced in response to a capture request submitted
+while in HDR mode.<wbr/></p>
+<p>Since substantial post-processing is generally needed to
+produce an HDR image,<wbr/> only YUV and JPEG outputs are
+supported for LIMITED/<wbr/>FULL device HDR captures,<wbr/> and only
+JPEG outputs are supported for LEGACY HDR
+captures.<wbr/> Using a RAW output for HDR capture is not
+supported.<wbr/></p></span>
                   </li>
                 </ul>
 
@@ -3913,8 +3967,7 @@
 supported by a given camera device.<wbr/> This field lists the
 valid anti-banding modes that the application may request
 for this camera device with the
-<a href="#controls_android.control.aeAntibandingMode">android.<wbr/>control.<wbr/>ae<wbr/>Antibanding<wbr/>Mode</a> control.<wbr/> This list
-always includes AUTO.<wbr/></p>
+<a href="#controls_android.control.aeAntibandingMode">android.<wbr/>control.<wbr/>ae<wbr/>Antibanding<wbr/>Mode</a> control.<wbr/></p>
             </td>
           </tr>
 
@@ -4079,8 +4132,12 @@
             </td>
 
             <td class="entry_range">
-              <p><code>Min.<wbr/>exposure compensation * <a href="#static_android.control.aeCompensationStep">android.<wbr/>control.<wbr/>ae<wbr/>Compensation<wbr/>Step</a> &lt;= -2 EV</code></p>
+              <p>Range [0,<wbr/>0] indicates that exposure compensation is not supported.<wbr/></p>
+<p>For LIMITED and FULL devices,<wbr/> range must follow below requirements if exposure
+compensation is supported (<code>range != [0,<wbr/> 0]</code>):</p>
+<p><code>Min.<wbr/>exposure compensation * <a href="#static_android.control.aeCompensationStep">android.<wbr/>control.<wbr/>ae<wbr/>Compensation<wbr/>Step</a> &lt;= -2 EV</code></p>
 <p><code>Max.<wbr/>exposure compensation * <a href="#static_android.control.aeCompensationStep">android.<wbr/>control.<wbr/>ae<wbr/>Compensation<wbr/>Step</a> &gt;= 2 EV</code></p>
+<p>LEGACY devices may support a smaller range than this.<wbr/></p>
             </td>
 
             <td class="entry_tags">
@@ -4990,7 +5047,8 @@
                     <span class="entry_type_enum_name">AUTO</span>
                     <span class="entry_type_enum_notes"><p>The camera device will automatically adapt its
 antibanding routine to the current illumination
-conditions.<wbr/> This is the default.<wbr/></p></span>
+condition.<wbr/> This is the default mode if AUTO is
+available on given camera device.<wbr/></p></span>
                   </li>
                 </ul>
 
@@ -5039,8 +5097,10 @@
 options for the antibanding mode.<wbr/> The
 <a href="#static_android.control.aeAvailableAntibandingModes">android.<wbr/>control.<wbr/>ae<wbr/>Available<wbr/>Antibanding<wbr/>Modes</a> key contains
 the available modes for a given camera device.<wbr/></p>
-<p>The default mode is AUTO,<wbr/> which is supported by all
-camera devices.<wbr/></p>
+<p>AUTO mode is the default if it is available on given
+camera device.<wbr/> When AUTO mode is not available,<wbr/> the
+default will be either 50HZ or 60HZ,<wbr/> and both 50HZ
+and 60HZ will be available.<wbr/></p>
 <p>If manual exposure control is enabled (by setting
 <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> or <a href="#controls_android.control.mode">android.<wbr/>control.<wbr/>mode</a> to OFF),<wbr/>
 then this setting has no effect,<wbr/> and the application must
@@ -5056,8 +5116,9 @@
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
               <p>For all capture request templates,<wbr/> this field must be set
-to AUTO.<wbr/>  AUTO is the only mode that must supported;
-OFF,<wbr/> 50HZ,<wbr/> 60HZ are all optional.<wbr/></p>
+to AUTO if AUTO mode is available.<wbr/> If AUTO is not available,<wbr/>
+the default must be either 50HZ or 60HZ,<wbr/> and both 50HZ and
+60HZ must be available.<wbr/></p>
 <p>If manual exposure control is enabled (by setting
 <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> or <a href="#controls_android.control.mode">android.<wbr/>control.<wbr/>mode</a> to OFF),<wbr/>
 then the exposure values provided by the application must not be
@@ -5252,6 +5313,14 @@
 <a href="#controls_android.sensor.frameDuration">android.<wbr/>sensor.<wbr/>frame<wbr/>Duration</a> are used by the camera
 device,<wbr/> along with android.<wbr/>flash.<wbr/>* fields,<wbr/> if there's
 a flash unit for this camera device.<wbr/></p>
+<p>Note that auto-white balance (AWB) and auto-focus (AF)
+behavior is device dependent when AE is in OFF mode.<wbr/>
+To have consistent behavior across different devices,<wbr/>
+it is recommended to either set AWB and AF to OFF mode
+or lock AWB and AF before setting AE to OFF.<wbr/>
+See <a href="#controls_android.control.awbMode">android.<wbr/>control.<wbr/>awb<wbr/>Mode</a>,<wbr/> <a href="#controls_android.control.afMode">android.<wbr/>control.<wbr/>af<wbr/>Mode</a>,<wbr/>
+<a href="#controls_android.control.awbLock">android.<wbr/>control.<wbr/>awb<wbr/>Lock</a>,<wbr/> and <a href="#controls_android.control.afTrigger">android.<wbr/>control.<wbr/>af<wbr/>Trigger</a>
+for more details.<wbr/></p>
 <p>LEGACY devices do not support the OFF mode and will
 override attempts to use this value to ON.<wbr/></p></span>
                   </li>
@@ -5556,9 +5625,9 @@
             <td class="entry_details" colspan="5">
               <p>This entry is normally set to IDLE,<wbr/> or is not
 included at all in the request settings.<wbr/> When included and
-set to START,<wbr/> the camera device will trigger the autoexposure
+set to START,<wbr/> the camera device will trigger the auto-exposure (AE)
 precapture metering sequence.<wbr/></p>
-<p>The precapture sequence should triggered before starting a
+<p>The precapture sequence should be triggered before starting a
 high-quality still capture for final metering decisions to
 be made,<wbr/> and for firing pre-capture flash pulses to estimate
 scene brightness and required final capture flash power,<wbr/> when
@@ -5566,6 +5635,14 @@
 <p>Normally,<wbr/> this entry should be set to START for only a
 single request,<wbr/> and the application should wait until the
 sequence completes before starting a new one.<wbr/></p>
+<p>When a precapture metering sequence is finished,<wbr/> the camera device
+may lock the auto-exposure routine internally to be able to accurately expose the
+subsequent still capture image (<code><a href="#controls_android.control.captureIntent">android.<wbr/>control.<wbr/>capture<wbr/>Intent</a> == STILL_<wbr/>CAPTURE</code>).<wbr/>
+For this case,<wbr/> the AE may not resume normal scan if no subsequent still capture is
+submitted.<wbr/> To ensure that the AE routine restarts normal scan,<wbr/> the application should
+submit a request with <code><a href="#controls_android.control.aeLock">android.<wbr/>control.<wbr/>ae<wbr/>Lock</a> == true</code>,<wbr/> followed by a request
+with <code><a href="#controls_android.control.aeLock">android.<wbr/>control.<wbr/>ae<wbr/>Lock</a> == false</code>,<wbr/> if the application decides not to submit a
+still capture request after the precapture sequence completes.<wbr/></p>
 <p>The exact effect of auto-exposure (AE) precapture trigger
 depends on the current AE mode and state; see
 <a href="#dynamic_android.control.aeState">android.<wbr/>control.<wbr/>ae<wbr/>State</a> for AE precapture state transition
@@ -5976,7 +6053,10 @@
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
               <p>Only effective if <a href="#controls_android.control.mode">android.<wbr/>control.<wbr/>mode</a> = AUTO and the lens is not fixed focus
-(i.<wbr/>e.<wbr/> <code><a href="#static_android.lens.info.minimumFocusDistance">android.<wbr/>lens.<wbr/>info.<wbr/>minimum<wbr/>Focus<wbr/>Distance</a> &gt; 0</code>).<wbr/></p>
+(i.<wbr/>e.<wbr/> <code><a href="#static_android.lens.info.minimumFocusDistance">android.<wbr/>lens.<wbr/>info.<wbr/>minimum<wbr/>Focus<wbr/>Distance</a> &gt; 0</code>).<wbr/> Also note that
+when <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> is OFF,<wbr/> the behavior of AF is device
+dependent.<wbr/> It is recommended to lock AF by using <a href="#controls_android.control.afTrigger">android.<wbr/>control.<wbr/>af<wbr/>Trigger</a> before
+setting <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a> to OFF,<wbr/> or set AF mode to OFF when AE is OFF.<wbr/></p>
 <p>If the lens is controlled by the camera device auto-focus algorithm,<wbr/>
 the camera device will report the current AF status in <a href="#dynamic_android.control.afState">android.<wbr/>control.<wbr/>af<wbr/>State</a>
 in result metadata.<wbr/></p>
@@ -6955,7 +7035,10 @@
 <p>When set to the ON mode,<wbr/> the camera device's auto-white balance
 routine is enabled,<wbr/> overriding the application's selected
 <a href="#controls_android.colorCorrection.transform">android.<wbr/>color<wbr/>Correction.<wbr/>transform</a>,<wbr/> <a href="#controls_android.colorCorrection.gains">android.<wbr/>color<wbr/>Correction.<wbr/>gains</a> and
-<a href="#controls_android.colorCorrection.mode">android.<wbr/>color<wbr/>Correction.<wbr/>mode</a>.<wbr/></p>
+<a href="#controls_android.colorCorrection.mode">android.<wbr/>color<wbr/>Correction.<wbr/>mode</a>.<wbr/> Note that when <a href="#controls_android.control.aeMode">android.<wbr/>control.<wbr/>ae<wbr/>Mode</a>
+is OFF,<wbr/> the behavior of AWB is device dependent.<wbr/> It is recommened to
+also set AWB mode to OFF or lock AWB by using <a href="#controls_android.control.awbLock">android.<wbr/>control.<wbr/>awb<wbr/>Lock</a> before
+setting AE mode to OFF.<wbr/></p>
 <p>When set to the OFF mode,<wbr/> the camera device's auto-white balance
 routine is disabled.<wbr/> The application manually controls the white
 balance by <a href="#controls_android.colorCorrection.transform">android.<wbr/>color<wbr/>Correction.<wbr/>transform</a>,<wbr/> <a href="#controls_android.colorCorrection.gains">android.<wbr/>color<wbr/>Correction.<wbr/>gains</a>
@@ -7763,10 +7846,38 @@
                   <li>
                     <span class="entry_type_enum_name">HDR</span>
                     <span class="entry_type_enum_optional">[optional]</span>
-                    <span class="entry_type_enum_optional">[hidden]</span>
-                    <span class="entry_type_enum_notes"><p>Turn on custom high dynamic range (HDR) mode.<wbr/></p>
-<p>This is intended for LEGACY mode devices only;
-HAL3+ camera devices should not implement this mode.<wbr/></p></span>
+                    <span class="entry_type_enum_notes"><p>Turn on a device-specific high dynamic range (HDR) mode.<wbr/></p>
+<p>In this scene mode,<wbr/> the camera device captures images
+that keep a larger range of scene illumination levels
+visible in the final image.<wbr/> For example,<wbr/> when taking a
+picture of a object in front of a bright window,<wbr/> both
+the object and the scene through the window may be
+visible when using HDR mode,<wbr/> while in normal AUTO mode,<wbr/>
+one or the other may be poorly exposed.<wbr/> As a tradeoff,<wbr/>
+HDR mode generally takes much longer to capture a single
+image,<wbr/> has no user control,<wbr/> and may have other artifacts
+depending on the HDR method used.<wbr/></p>
+<p>Therefore,<wbr/> HDR captures operate at a much slower rate
+than regular captures.<wbr/></p>
+<p>In this mode,<wbr/> on LIMITED or FULL devices,<wbr/> when a request
+is made with a <a href="#controls_android.control.captureIntent">android.<wbr/>control.<wbr/>capture<wbr/>Intent</a> of
+STILL_<wbr/>CAPTURE,<wbr/> the camera device will capture an image
+using a high dynamic range capture technique.<wbr/>  On LEGACY
+devices,<wbr/> captures that target a JPEG-format output will
+be captured with HDR,<wbr/> and the capture intent is not
+relevant.<wbr/></p>
+<p>The HDR capture may involve the device capturing a burst
+of images internally and combining them into one,<wbr/> or it
+may involve the device using specialized high dynamic
+range capture hardware.<wbr/> In all cases,<wbr/> a single image is
+produced in response to a capture request submitted
+while in HDR mode.<wbr/></p>
+<p>Since substantial post-processing is generally needed to
+produce an HDR image,<wbr/> only YUV and JPEG outputs are
+supported for LIMITED/<wbr/>FULL device HDR captures,<wbr/> and only
+JPEG outputs are supported for LEGACY HDR
+captures.<wbr/> Using a RAW output for HDR capture is not
+supported.<wbr/></p></span>
                   </li>
                 </ul>
 
@@ -13751,6 +13862,53 @@
   resolution of JPEG streams.<wbr/></li>
 </ul></span>
                   </li>
+                  <li>
+                    <span class="entry_type_enum_name">READ_SENSOR_SETTINGS</span>
+                    <span class="entry_type_enum_optional">[optional]</span>
+                    <span class="entry_type_enum_notes"><p>The camera device supports accurately reporting the sensor settings for many of
+the sensor controls while the built-in 3A algorithm is running.<wbr/>  This allows
+reporting of sensor settings even when these settings cannot be manually changed.<wbr/></p>
+<p>The values reported for the following controls are guaranteed to be available
+in the CaptureResult,<wbr/> including when 3A is enabled:</p>
+<ul>
+<li>Exposure control<ul>
+<li><a href="#controls_android.sensor.exposureTime">android.<wbr/>sensor.<wbr/>exposure<wbr/>Time</a></li>
+</ul>
+</li>
+<li>Sensitivity control<ul>
+<li><a href="#controls_android.sensor.sensitivity">android.<wbr/>sensor.<wbr/>sensitivity</a></li>
+</ul>
+</li>
+<li>Lens controls (if the lens is adjustable)<ul>
+<li><a href="#controls_android.lens.focusDistance">android.<wbr/>lens.<wbr/>focus<wbr/>Distance</a></li>
+<li><a href="#controls_android.lens.aperture">android.<wbr/>lens.<wbr/>aperture</a></li>
+</ul>
+</li>
+</ul>
+<p>This capability is a subset of the MANUAL_<wbr/>SENSOR control capability,<wbr/> and will
+always be included if the MANUAL_<wbr/>SENSOR capability is available.<wbr/></p></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">BURST_CAPTURE</span>
+                    <span class="entry_type_enum_optional">[optional]</span>
+                    <span class="entry_type_enum_notes"><p>The camera device supports capturing maximum-resolution
+images at &gt;= 20 frames per second,<wbr/> in at least the
+uncompressed YUV format,<wbr/> when post-processing settings
+are set to FAST.<wbr/></p>
+<p>More specifically,<wbr/> this means that a size matching the
+camera device's active array size is listed as a
+supported size for the YUV_<wbr/>420_<wbr/>888 format in
+<a href="#static_android.scaler.streamConfigurationMap">android.<wbr/>scaler.<wbr/>stream<wbr/>Configuration<wbr/>Map</a>,<wbr/> the minimum frame
+duration for that format and size is &lt;= 1/<wbr/>20 s,<wbr/> and
+the <a href="#static_android.control.aeAvailableTargetFpsRanges">android.<wbr/>control.<wbr/>ae<wbr/>Available<wbr/>Target<wbr/>Fps<wbr/>Ranges</a> entry
+lists at least one FPS range where the minimum FPS is</p>
+<blockquote>
+<p>= 1 /<wbr/> minimumFrameDuration for the maximum-size
+YUV_<wbr/>420_<wbr/>888 format.<wbr/></p>
+</blockquote>
+<p>In addition,<wbr/> the <a href="#static_android.sync.maxLatency">android.<wbr/>sync.<wbr/>max<wbr/>Latency</a> field is
+guaranted to have a value between 0 and 4,<wbr/> inclusive.<wbr/></p></span>
+                  </li>
                 </ul>
 
             </td> <!-- entry_type -->
@@ -22594,12 +22752,16 @@
               <p>Camera devices will come in three flavors: LEGACY,<wbr/> LIMITED and FULL.<wbr/></p>
 <p>A FULL device will support below capabilities:</p>
 <ul>
-<li>30fps at maximum resolution (== sensor resolution) is preferred,<wbr/> more than 20fps is required.<wbr/></li>
+<li>30fps operation at maximum resolution (== sensor resolution) is preferred,<wbr/> more than
+  20fps is required,<wbr/> for at least uncompressed YUV
+  output.<wbr/> (<a href="#static_android.request.availableCapabilities">android.<wbr/>request.<wbr/>available<wbr/>Capabilities</a> contains BURST_<wbr/>CAPTURE)</li>
 <li>Per frame control (<a href="#static_android.sync.maxLatency">android.<wbr/>sync.<wbr/>max<wbr/>Latency</a> <code>==</code> PER_<wbr/>FRAME_<wbr/>CONTROL)</li>
 <li>Manual sensor control (<a href="#static_android.request.availableCapabilities">android.<wbr/>request.<wbr/>available<wbr/>Capabilities</a> contains MANUAL_<wbr/>SENSOR)</li>
-<li>Manual post-processing control (<a href="#static_android.request.availableCapabilities">android.<wbr/>request.<wbr/>available<wbr/>Capabilities</a> contains MANUAL_<wbr/>POST_<wbr/>PROCESSING)</li>
+<li>Manual post-processing control (<a href="#static_android.request.availableCapabilities">android.<wbr/>request.<wbr/>available<wbr/>Capabilities</a> contains
+  MANUAL_<wbr/>POST_<wbr/>PROCESSING)</li>
 <li>Arbitrary cropping region (<a href="#static_android.scaler.croppingType">android.<wbr/>scaler.<wbr/>cropping<wbr/>Type</a> <code>==</code> FREEFORM)</li>
-<li>At least 3 processed (but not stalling) format output streams (<a href="#static_android.request.maxNumOutputProc">android.<wbr/>request.<wbr/>max<wbr/>Num<wbr/>Output<wbr/>Proc</a> <code>&gt;=</code> 3)</li>
+<li>At least 3 processed (but not stalling) format output streams
+  (<a href="#static_android.request.maxNumOutputProc">android.<wbr/>request.<wbr/>max<wbr/>Num<wbr/>Output<wbr/>Proc</a> <code>&gt;=</code> 3)</li>
 <li>The required stream configuration defined in <a href="#static_android.scaler.availableStreamConfigurations">android.<wbr/>scaler.<wbr/>available<wbr/>Stream<wbr/>Configurations</a></li>
 <li>The required exposure time range defined in <a href="#static_android.sensor.info.exposureTimeRange">android.<wbr/>sensor.<wbr/>info.<wbr/>exposure<wbr/>Time<wbr/>Range</a></li>
 <li>The required maxFrameDuration defined in <a href="#static_android.sensor.info.maxFrameDuration">android.<wbr/>sensor.<wbr/>info.<wbr/>max<wbr/>Frame<wbr/>Duration</a></li>
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index c3a8eb4..d7ce6df 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -336,10 +336,10 @@
           <details>
             This key lists the valid modes for android.colorCorrection.aberrationMode.  If no
             aberration correction modes are available for a device, this list will solely include
-            OFF mode.
+            OFF mode. All camera devices will support either OFF or FAST mode.
 
-            For FULL capability device (android.info.supportedHardwareLevel `==` FULL), OFF is
-            always included.
+            Camera devices that support the MANUAL_POST_PROCESSING capability will always list
+            OFF mode. This includes all FULL level devices.
 
             LEGACY devices will always only support FAST mode.
           </details>
@@ -375,7 +375,8 @@
               <notes>
                 The camera device will automatically adapt its
                 antibanding routine to the current illumination
-                conditions. This is the default.
+                condition. This is the default mode if AUTO is
+                available on given camera device.
               </notes>
             </value>
           </enum>
@@ -409,8 +410,10 @@
             android.control.aeAvailableAntibandingModes key contains
             the available modes for a given camera device.
 
-            The default mode is AUTO, which is supported by all
-            camera devices.
+            AUTO mode is the default if it is available on given
+            camera device. When AUTO mode is not available, the
+            default will be either 50HZ or 60HZ, and both 50HZ
+            and 60HZ will be available.
 
             If manual exposure control is enabled (by setting
             android.control.aeMode or android.control.mode to OFF),
@@ -421,8 +424,9 @@
           </details>
           <hal_details>
             For all capture request templates, this field must be set
-            to AUTO.  AUTO is the only mode that must supported;
-            OFF, 50HZ, 60HZ are all optional.
+            to AUTO if AUTO mode is available. If AUTO is not available,
+            the default must be either 50HZ or 60HZ, and both 50HZ and
+            60HZ must be available.
 
             If manual exposure control is enabled (by setting
             android.control.aeMode or android.control.mode to OFF),
@@ -524,6 +528,15 @@
                 device, along with android.flash.* fields, if there's
                 a flash unit for this camera device.
 
+                Note that auto-white balance (AWB) and auto-focus (AF)
+                behavior is device dependent when AE is in OFF mode.
+                To have consistent behavior across different devices,
+                it is recommended to either set AWB and AF to OFF mode
+                or lock AWB and AF before setting AE to OFF.
+                See android.control.awbMode, android.control.afMode,
+                android.control.awbLock, and android.control.afTrigger
+                for more details.
+
                 LEGACY devices do not support the OFF mode and will
                 override attempts to use this value to ON.
               </notes>
@@ -692,10 +705,10 @@
           metering sequence when it processes this request.</description>
           <details>This entry is normally set to IDLE, or is not
           included at all in the request settings. When included and
-          set to START, the camera device will trigger the autoexposure
+          set to START, the camera device will trigger the auto-exposure (AE)
           precapture metering sequence.
 
-          The precapture sequence should triggered before starting a
+          The precapture sequence should be triggered before starting a
           high-quality still capture for final metering decisions to
           be made, and for firing pre-capture flash pulses to estimate
           scene brightness and required final capture flash power, when
@@ -705,6 +718,15 @@
           single request, and the application should wait until the
           sequence completes before starting a new one.
 
+          When a precapture metering sequence is finished, the camera device
+          may lock the auto-exposure routine internally to be able to accurately expose the
+          subsequent still capture image (`android.control.captureIntent == STILL_CAPTURE`).
+          For this case, the AE may not resume normal scan if no subsequent still capture is
+          submitted. To ensure that the AE routine restarts normal scan, the application should
+          submit a request with `android.control.aeLock == true`, followed by a request
+          with `android.control.aeLock == false`, if the application decides not to submit a
+          still capture request after the precapture sequence completes.
+
           The exact effect of auto-exposure (AE) precapture trigger
           depends on the current AE mode and state; see
           android.control.aeState for AE precapture state transition
@@ -807,7 +829,10 @@
           mode it is set to.</description>
           <range>android.control.afAvailableModes</range>
           <details>Only effective if android.control.mode = AUTO and the lens is not fixed focus
-          (i.e. `android.lens.info.minimumFocusDistance &gt; 0`).
+          (i.e. `android.lens.info.minimumFocusDistance &gt; 0`). Also note that
+          when android.control.aeMode is OFF, the behavior of AF is device
+          dependent. It is recommended to lock AF by using android.control.afTrigger before
+          setting android.control.aeMode to OFF, or set AF mode to OFF when AE is OFF.
 
           If the lens is controlled by the camera device auto-focus algorithm,
           the camera device will report the current AF status in android.control.afState
@@ -1107,7 +1132,10 @@
           When set to the ON mode, the camera device's auto-white balance
           routine is enabled, overriding the application's selected
           android.colorCorrection.transform, android.colorCorrection.gains and
-          android.colorCorrection.mode.
+          android.colorCorrection.mode. Note that when android.control.aeMode
+          is OFF, the behavior of AWB is device dependent. It is recommened to
+          also set AWB mode to OFF or lock AWB by using android.control.awbLock before
+          setting AE mode to OFF.
 
           When set to the OFF mode, the camera device's auto-white balance
           routine is disabled. The application manually controls the white
@@ -1555,12 +1583,45 @@
               the application avoids unnecessary scene mode switch as much as possible.
               </notes>
             </value>
-            <value optional="true" hidden="true">HDR
+            <value optional="true">HDR
               <notes>
-              Turn on custom high dynamic range (HDR) mode.
+              Turn on a device-specific high dynamic range (HDR) mode.
 
-              This is intended for LEGACY mode devices only;
-              HAL3+ camera devices should not implement this mode.
+              In this scene mode, the camera device captures images
+              that keep a larger range of scene illumination levels
+              visible in the final image. For example, when taking a
+              picture of a object in front of a bright window, both
+              the object and the scene through the window may be
+              visible when using HDR mode, while in normal AUTO mode,
+              one or the other may be poorly exposed. As a tradeoff,
+              HDR mode generally takes much longer to capture a single
+              image, has no user control, and may have other artifacts
+              depending on the HDR method used.
+
+              Therefore, HDR captures operate at a much slower rate
+              than regular captures.
+
+              In this mode, on LIMITED or FULL devices, when a request
+              is made with a android.control.captureIntent of
+              STILL_CAPTURE, the camera device will capture an image
+              using a high dynamic range capture technique.  On LEGACY
+              devices, captures that target a JPEG-format output will
+              be captured with HDR, and the capture intent is not
+              relevant.
+
+              The HDR capture may involve the device capturing a burst
+              of images internally and combining them into one, or it
+              may involve the device using specialized high dynamic
+              range capture hardware. In all cases, a single image is
+              produced in response to a capture request submitted
+              while in HDR mode.
+
+              Since substantial post-processing is generally needed to
+              produce an HDR image, only YUV and JPEG outputs are
+              supported for LIMITED/FULL device HDR captures, and only
+              JPEG outputs are supported for LEGACY HDR
+              captures. Using a RAW output for HDR capture is not
+              supported.
               </notes>
             </value>
           </enum>
@@ -1650,8 +1711,7 @@
             supported by a given camera device. This field lists the
             valid anti-banding modes that the application may request
             for this camera device with the
-            android.control.aeAntibandingMode control. This list
-            always includes AUTO.
+            android.control.aeAntibandingMode control.
           </details>
           <tag id="BC" />
         </entry>
@@ -1712,9 +1772,16 @@
           android.control.aeExposureCompensation, in counts of android.control.aeCompensationStep,
           that are supported by this camera device.</description>
           <range>
+            Range [0,0] indicates that exposure compensation is not supported.
+
+            For LIMITED and FULL devices, range must follow below requirements if exposure
+            compensation is supported (`range != [0, 0]`):
+
             `Min.exposure compensation * android.control.aeCompensationStep &lt;= -2 EV`
 
             `Max.exposure compensation * android.control.aeCompensationStep &gt;= 2 EV`
+
+            LEGACY devices may support a smaller range than this.
           </range>
           <tag id="BC" />
         </entry>
@@ -3941,6 +4008,48 @@
                 resolution of JPEG streams.
               </notes>
             </value>
+            <value optional="true">READ_SENSOR_SETTINGS
+              <notes>
+              The camera device supports accurately reporting the sensor settings for many of
+              the sensor controls while the built-in 3A algorithm is running.  This allows
+              reporting of sensor settings even when these settings cannot be manually changed.
+
+              The values reported for the following controls are guaranteed to be available
+              in the CaptureResult, including when 3A is enabled:
+
+              * Exposure control
+                  * android.sensor.exposureTime
+              * Sensitivity control
+                  * android.sensor.sensitivity
+              * Lens controls (if the lens is adjustable)
+                  * android.lens.focusDistance
+                  * android.lens.aperture
+
+              This capability is a subset of the MANUAL_SENSOR control capability, and will
+              always be included if the MANUAL_SENSOR capability is available.
+              </notes>
+            </value>
+            <value optional="true">BURST_CAPTURE
+              <notes>
+              The camera device supports capturing maximum-resolution
+              images at &gt;= 20 frames per second, in at least the
+              uncompressed YUV format, when post-processing settings
+              are set to FAST.
+
+              More specifically, this means that a size matching the
+              camera device's active array size is listed as a
+              supported size for the YUV_420_888 format in
+              android.scaler.streamConfigurationMap, the minimum frame
+              duration for that format and size is &lt;= 1/20 s, and
+              the android.control.aeAvailableTargetFpsRanges entry
+              lists at least one FPS range where the minimum FPS is
+              &gt;= 1 / minimumFrameDuration for the maximum-size
+              YUV_420_888 format.
+
+              In addition, the android.sync.maxLatency field is
+              guaranted to have a value between 0 and 4, inclusive.
+              </notes>
+            </value>
           </enum>
           <description>List of capabilities that this camera device
           advertises as fully supporting.</description>
@@ -6877,12 +6986,16 @@
 
           A FULL device will support below capabilities:
 
-          * 30fps at maximum resolution (== sensor resolution) is preferred, more than 20fps is required.
+          * 30fps operation at maximum resolution (== sensor resolution) is preferred, more than
+            20fps is required, for at least uncompressed YUV
+            output. (android.request.availableCapabilities contains BURST_CAPTURE)
           * Per frame control (android.sync.maxLatency `==` PER_FRAME_CONTROL)
           * Manual sensor control (android.request.availableCapabilities contains MANUAL_SENSOR)
-          * Manual post-processing control (android.request.availableCapabilities contains MANUAL_POST_PROCESSING)
+          * Manual post-processing control (android.request.availableCapabilities contains
+            MANUAL_POST_PROCESSING)
           * Arbitrary cropping region (android.scaler.croppingType `==` FREEFORM)
-          * At least 3 processed (but not stalling) format output streams (android.request.maxNumOutputProc `&gt;=` 3)
+          * At least 3 processed (but not stalling) format output streams
+            (android.request.maxNumOutputProc `&gt;=` 3)
           * The required stream configuration defined in android.scaler.availableStreamConfigurations
           * The required exposure time range defined in android.sensor.info.exposureTimeRange
           * The required maxFrameDuration defined in android.sensor.info.maxFrameDuration
diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h
index 0bc09cd..e6349c2 100644
--- a/camera/include/system/camera_metadata_tags.h
+++ b/camera/include/system/camera_metadata_tags.h
@@ -662,6 +662,8 @@
     ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING,
     ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW,
     ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ZSL,
+    ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS,
+    ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE,
 } camera_metadata_enum_android_request_available_capabilities_t;
 
 
diff --git a/camera/src/camera_metadata_tag_info.c b/camera/src/camera_metadata_tag_info.c
index fdf41ff..14174c3 100644
--- a/camera/src/camera_metadata_tag_info.c
+++ b/camera/src/camera_metadata_tag_info.c
@@ -1648,6 +1648,14 @@
                     msg = "ZSL";
                     ret = 0;
                     break;
+                case ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS:
+                    msg = "READ_SENSOR_SETTINGS";
+                    ret = 0;
+                    break;
+                case ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE:
+                    msg = "BURST_CAPTURE";
+                    ret = 0;
+                    break;
                 default:
                     msg = "error: enum value out of range";
             }