Snap for 4448085 from 1e36223ffcc93b39407cc719d876b8135826c91f to oc-m3-release

Change-Id: I9038a59a5d51f5872cfa5c2676d75b4c61193cc1
diff --git a/camera/include/HdrPlusTypes.h b/camera/include/HdrPlusTypes.h
index 407d67b..9f66ffb 100644
--- a/camera/include/HdrPlusTypes.h
+++ b/camera/include/HdrPlusTypes.h
@@ -149,6 +149,10 @@
     // Easel, this offset should be subtracted from AP timestamp.
     int64_t timestampOffsetNs;
 
+    // Sensor timestamp offset due to sensor cropping. When comparing timestamps between AP and
+    // Easel, this offset should be subtracted from AP timestamp.
+    int64_t timestampCropOffsetNs;
+
     // Sensor output format as defined in android_pixel_format.
     int format;
 
@@ -257,34 +261,11 @@
     std::vector<float> availableFocalLengths; // android.lens.info.availableFocalLengths
     std::array<int32_t, 2> shadingMapSize; // android.lens.info.shadingMapSize
     uint8_t focusDistanceCalibration; // android.lens.info.focusDistanceCalibration
+    std::array<int32_t, 2> aeCompensationRange; // android.control.aeCompensationRange
+    float aeCompensationStep; // android.control.aeCompensationStep
 
     uint32_t debugParams; // Use HDRPLUS_DEBUG_PARAM_*
 
-    // Check if the contents of lhs and rhs are equal. For vector and array variables, two are
-    // equal if their elements are equal at the same position.
-    bool operator==(const StaticMetadata& rhs) const {
-        return flashInfoAvailable == rhs.flashInfoAvailable &&
-               sensitivityRange == rhs.sensitivityRange &&
-               maxAnalogSensitivity == rhs.maxAnalogSensitivity &&
-               pixelArraySize == rhs.pixelArraySize &&
-               activeArraySize == rhs.activeArraySize &&
-               opticalBlackRegions == rhs.opticalBlackRegions &&
-               availableStreamConfigurations == rhs.availableStreamConfigurations &&
-               referenceIlluminant1 == rhs.referenceIlluminant1 &&
-               referenceIlluminant2 == rhs.referenceIlluminant2 &&
-               calibrationTransform1 == rhs.calibrationTransform1 &&
-               calibrationTransform2 == rhs.calibrationTransform2 &&
-               colorTransform1 == rhs.colorTransform1 &&
-               colorTransform2 == rhs.colorTransform2 &&
-               whiteLevel == rhs.whiteLevel &&
-               colorFilterArrangement == rhs.colorFilterArrangement &&
-               availableApertures == rhs.availableApertures &&
-               availableFocalLengths == rhs.availableFocalLengths &&
-               shadingMapSize == rhs.shadingMapSize &&
-               focusDistanceCalibration == rhs.focusDistanceCalibration &&
-               debugParams == rhs.debugParams;
-    }
-
     // Convert this static metadata to a string and append it to the specified string.
     void appendToString(std::string *strOut) const {
         if (strOut == nullptr) return;
@@ -316,6 +297,10 @@
         metadatautils::appendVectorOrArrayToString(strOut, "shadingMapSize", shadingMapSize);
         metadatautils::appendValueToString(strOut, "focusDistanceCalibration",
                 focusDistanceCalibration);
+        metadatautils::appendVectorOrArrayToString(strOut, "aeCompensationRange",
+                aeCompensationRange);
+        metadatautils::appendValueToString(strOut, "aeCompensationStep",
+                aeCompensationStep);
         metadatautils::appendValueToString(strOut, "debugParams", debugParams);
     }
 };
@@ -349,31 +334,12 @@
     std::array<float, 4> dynamicBlackLevel; // android.sensor.dynamicBlackLevel
     std::vector<float> lensShadingMap; // android.statistics.lensShadingMap
     float focusDistance; // android.lens.focusDistance
-
-    // Check if the contents of lhs and rhs are equal. For vector and array variables, two are
-    // equal if their elements are equal at the same position.
-    bool operator==(const FrameMetadata& rhs) const {
-        return easelTimestamp == rhs.easelTimestamp &&
-               exposureTime == rhs.exposureTime &&
-               sensitivity == rhs.sensitivity &&
-               postRawSensitivityBoost == rhs.postRawSensitivityBoost &&
-               flashMode == rhs.flashMode &&
-               colorCorrectionGains == rhs.colorCorrectionGains &&
-               colorCorrectionTransform == rhs.colorCorrectionTransform &&
-               neutralColorPoint == rhs.neutralColorPoint &&
-               timestamp == rhs.timestamp &&
-               blackLevelLock == rhs.blackLevelLock &&
-               faceDetectMode == rhs.faceDetectMode &&
-               faceIds == rhs.faceIds &&
-               faceLandmarks == rhs.faceLandmarks &&
-               faceRectangles == rhs.faceRectangles &&
-               faceScores == rhs.faceScores &&
-               sceneFlicker == rhs.sceneFlicker &&
-               noiseProfile == rhs.noiseProfile &&
-               dynamicBlackLevel == rhs.dynamicBlackLevel &&
-               lensShadingMap == rhs.lensShadingMap &&
-               focusDistance == rhs.focusDistance;
-    }
+    int32_t aeExposureCompensation; // android.control.aeExposureCompensation
+    uint8_t aeMode; // android.control.aeMode
+    uint8_t aeLock; // android.control.aeLock
+    uint8_t aeState; // android.control.aeState
+    uint8_t aePrecaptureTrigger; // android.control.aePrecaptureTrigger
+    std::vector<std::array<int32_t, 5>> aeRegions; // android.control.aeRegions
 
     // Convert this static metadata to a string and append it to the specified string.
     void appendToString(std::string *strOut) const {
@@ -402,6 +368,12 @@
         metadatautils::appendVectorOrArrayToString(strOut, "dynamicBlackLevel", dynamicBlackLevel);
         metadatautils::appendVectorOrArrayToString(strOut, "lensShadingMap", lensShadingMap);
         metadatautils::appendValueToString(strOut, "focusDistance", focusDistance);
+        metadatautils::appendValueToString(strOut, "aeExposureCompensation", aeExposureCompensation);
+        metadatautils::appendValueToString(strOut, "aeMode", aeMode);
+        metadatautils::appendValueToString(strOut, "aeLock", aeLock);
+        metadatautils::appendValueToString(strOut, "aeState", aeState);
+        metadatautils::appendValueToString(strOut, "aePrecaptureTrigger", aePrecaptureTrigger);
+        metadatautils::appendVectorArrayToString(strOut, "aeRegions", aeRegions);
     }
 };
 
@@ -413,21 +385,16 @@
  */
 struct RequestMetadata {
     std::array<int32_t, 4> cropRegion; // android.scaler.cropRegion (x_min, y_min, width, height)
+    int32_t aeExposureCompensation; // android.control.aeExposureCompensation
+
     bool postviewEnable; // com.google.nexus.experimental2017.stats.postview_enable
     bool continuousCapturing; // Whether to capture RAW while HDR+ processing.
 
-    // Check if the contents of lhs and rhs are equal. For vector and array variables, two are
-    // equal if their elements are equal at the same position.
-    bool operator==(const RequestMetadata& rhs) const {
-        return cropRegion == rhs.cropRegion &&
-               postviewEnable == rhs.postviewEnable &&
-               continuousCapturing == rhs.continuousCapturing;
-    }
-
     // Convert this static metadata to a string and append it to the specified string.
     void appendToString(std::string *strOut) const {
         if (strOut == nullptr) return;
         metadatautils::appendVectorOrArrayToString(strOut, "cropRegion", cropRegion);
+        metadatautils::appendValueToString(strOut, "aeExposureCompensation", aeExposureCompensation);
         metadatautils::appendValueToString(strOut, "postviewEnable", postviewEnable);
         metadatautils::appendValueToString(strOut, "continuousCapturing", continuousCapturing);
     }
@@ -445,14 +412,6 @@
                        // frame.
     std::string makernote; // Obfuscated capture information.
 
-    // Check if the contents of lhs and rhs are equal. For vector and array variables, two are
-    // equal if their elements are equal at the same position.
-    bool operator==(const ResultMetadata& rhs) const {
-        return easelTimestamp == rhs.easelTimestamp &&
-               timestamp == rhs.timestamp &&
-               makernote == rhs.makernote;
-    }
-
     // Convert this static metadata to a string and append it to the specified string.
     void appendToString(std::string *strOut) const {
         if (strOut == nullptr) return;
diff --git a/camera/libhdrplusclient/include/HdrPlusClient.h b/camera/libhdrplusclient/include/HdrPlusClient.h
index 7896c89..40905cc 100644
--- a/camera/libhdrplusclient/include/HdrPlusClient.h
+++ b/camera/libhdrplusclient/include/HdrPlusClient.h
@@ -33,7 +33,9 @@
  */
 class HdrPlusClient {
 public:
-    HdrPlusClient() {};
+    // HdrPlusClientListener is the listener to receive callbacks from HDR+ client. The listener
+    // must be valid during the life cycle of HdrPlusClient
+    HdrPlusClient(HdrPlusClientListener *) {};
     /*
      * The recommended way to create an HdrPlusClient instance is via
      * EaselManagerClient::openHdrPlusClientAsync() or EaselManagerClient::openHdrPlusClientAsync().
@@ -47,17 +49,12 @@
      *
      * If EaselManagerClient is used to create the HdrPlusClient, it is already connected.
      *
-     * listener is the listener to receive callbacks from HDR+ client.
-     *
      * Returns:
      *  0:          on success.
      *  -EEXIST:    if it's already connected.
      *  -ENODEV:    if connecting failed due to a serious error.
      */
-    virtual status_t connect(HdrPlusClientListener *listener) = 0;
-
-    // Disconnect from HDR+ service.
-    virtual void disconnect() = 0;
+    virtual status_t connect() = 0;
 
     /*
      * Set the static metadata of current camera device.