QCamera2: HAL3: Pass HYBRID_AE_ENABLE in capture result

Cache HYBRID_AE_ENABLE setting in pending request, and pass back in
capture result.

Also add HYBRID_AE tag in supported request and result list

Bug: 27129493
Change-Id: Ie4c3b229875ebedb186f370e0c95ba5105ba19ff
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 74ae304..f64b9b3 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -342,6 +342,7 @@
       mUpdateDebugLevel(false),
       mCallbacks(callbacks),
       mCaptureIntent(0),
+      mHybridAeEnable(0),
       mBatchSize(0),
       mToBeQueuedVidBufs(0),
       mHFRVideoFps(DEFAULT_VIDEO_FPS),
@@ -2597,7 +2598,7 @@
 
             result.result = translateFromHalMetadata(metadata,
                     i->timestamp, i->request_id, i->jpegMetadata, i->pipeline_depth,
-                    i->capture_intent, internalPproc);
+                    i->capture_intent, i->hybrid_ae_enable, internalPproc);
 
             saveExifParams(metadata);
 
@@ -3494,7 +3495,12 @@
         mCaptureIntent =
                 meta.find(ANDROID_CONTROL_CAPTURE_INTENT).data.u8[0];
     }
+    if (meta.exists(NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE)) {
+        mHybridAeEnable =
+                meta.find(NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE).data.u8[0];
+    }
     pendingRequest.capture_intent = mCaptureIntent;
+    pendingRequest.hybrid_ae_enable = mHybridAeEnable;
 
     for (size_t i = 0; i < request->num_output_buffers; i++) {
         RequestedBufferInfo requestedBuf;
@@ -4013,6 +4019,7 @@
  *   @metadata : metadata information from callback
  *   @timestamp: metadata buffer timestamp
  *   @request_id: request id
+ *   @hybrid_ae_enable: whether hybrid ae is enabled
  *   @jpegMetadata: additional jpeg metadata
  *   @pprocDone: whether internal offline postprocsesing is done
  *
@@ -4027,6 +4034,7 @@
                                  const CameraMetadata& jpegMetadata,
                                  uint8_t pipeline_depth,
                                  uint8_t capture_intent,
+                                 uint8_t hybrid_ae_enable,
                                  bool pprocDone)
 {
     CameraMetadata camMetadata;
@@ -4039,6 +4047,7 @@
     camMetadata.update(ANDROID_REQUEST_ID, &request_id, 1);
     camMetadata.update(ANDROID_REQUEST_PIPELINE_DEPTH, &pipeline_depth, 1);
     camMetadata.update(ANDROID_CONTROL_CAPTURE_INTENT, &capture_intent, 1);
+    camMetadata.update(NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE, &hybrid_ae_enable, 1);
 
     IF_META_AVAILABLE(uint32_t, frame_number, CAM_INTF_META_FRAME_NUMBER, metadata) {
         int64_t fwk_frame_number = *frame_number;
@@ -6466,7 +6475,7 @@
        ANDROID_STATISTICS_HISTOGRAM_MODE, ANDROID_STATISTICS_SHARPNESS_MAP_MODE,
        ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, ANDROID_TONEMAP_CURVE_BLUE,
        ANDROID_TONEMAP_CURVE_GREEN, ANDROID_TONEMAP_CURVE_RED, ANDROID_TONEMAP_MODE,
-       ANDROID_BLACK_LEVEL_LOCK };
+       ANDROID_BLACK_LEVEL_LOCK, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE};
 
     size_t request_keys_cnt =
             sizeof(request_keys_basic)/sizeof(request_keys_basic[0]);
@@ -6502,7 +6511,7 @@
        ANDROID_STATISTICS_SCENE_FLICKER, ANDROID_STATISTICS_FACE_RECTANGLES,
        ANDROID_STATISTICS_FACE_SCORES,
        ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL,
-       ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL,
+       ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE,
        ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST };
     size_t result_keys_cnt =
             sizeof(result_keys_basic)/sizeof(result_keys_basic[0]);
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.h b/camera/QCamera2/HAL3/QCamera3HWI.h
index 75055b0..2162079 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.h
+++ b/camera/QCamera2/HAL3/QCamera3HWI.h
@@ -173,7 +173,8 @@
     camera_metadata_t* translateFromHalMetadata(metadata_buffer_t *metadata,
                             nsecs_t timestamp, int32_t request_id,
                             const CameraMetadata& jpegMetadata, uint8_t pipeline_depth,
-                            uint8_t capture_intent, bool pprocDone);
+                            uint8_t capture_intent, uint8_t hybrid_ae_enable,
+                            bool pprocDone);
     camera_metadata_t* saveRequestSettings(const CameraMetadata& jpegMetadata,
                             camera3_capture_request_t *request);
     int initParameters();
@@ -342,6 +343,7 @@
         uint32_t partial_result_cnt;
         uint8_t capture_intent;
         bool shutter_notified;
+        uint8_t hybrid_ae_enable;
     } PendingRequestInfo;
     typedef struct {
         uint32_t frame_number;
@@ -405,6 +407,7 @@
     const camera_module_callbacks_t *mCallbacks;
 
     uint8_t mCaptureIntent;
+    uint8_t mHybridAeEnable;
     metadata_buffer_t mReprocMeta; //scratch meta buffer
     /* 0: Not batch, non-zero: Number of image buffers in a batch */
     uint8_t mBatchSize;
diff --git a/camera/QCamera2/HAL3/QCamera3VendorTags.cpp b/camera/QCamera2/HAL3/QCamera3VendorTags.cpp
index 953c6fd..463a9c3 100644
--- a/camera/QCamera2/HAL3/QCamera3VendorTags.cpp
+++ b/camera/QCamera2/HAL3/QCamera3VendorTags.cpp
@@ -125,7 +125,7 @@
 
 vendor_tag_info_t nexus_experimental_2016[NEXUS_EXPERIMENTAL_2016_END -
         NEXUS_EXPERIMENTAL_2016_START] = {
-   {"3a.hybrid_3a_enable", TYPE_BYTE }
+   {"3a.hybrid_ae_enable", TYPE_BYTE }
 };
 
 vendor_tag_info_t *qcamera3_tag_info[QCAMERA3_SECTIONS_END -