Qcamera2: add vendor tag to support DevCamDebug meta

First vendor tag to support DevCamDebug metadata.
Will be adding more in the future.

Bug: 28669791

Change-Id: I8ea2965943bef65309d5d48cff2852e8e970aa79
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index 29f6597..07a754f 100644
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -366,6 +366,9 @@
       mCaptureIntent(0),
       mCacMode(0),
       mHybridAeEnable(0),
+      /* DevCamDebug metadata internal m control*/
+      mDevCamDebugMetaEnable(0),
+      /* DevCamDebug metadata end */
       mBatchSize(0),
       mToBeQueuedVidBufs(0),
       mHFRVideoFps(DEFAULT_VIDEO_FPS),
@@ -2873,7 +2876,11 @@
 
             result.result = translateFromHalMetadata(metadata,
                     i->timestamp, i->request_id, i->jpegMetadata, i->pipeline_depth,
-                    i->capture_intent, i->hybrid_ae_enable, internalPproc, i->fwkCacMode);
+                    i->capture_intent, i->hybrid_ae_enable,
+                     /* DevCamDebug metadata translateFromHalMetadata function call*/
+                    i->DevCamDebug_meta_enable,
+                    /* DevCamDebug metadata end */
+                    internalPproc, i->fwkCacMode);
 
             saveExifParams(metadata);
 
@@ -3790,6 +3797,12 @@
     }
     pendingRequest.capture_intent = mCaptureIntent;
     pendingRequest.hybrid_ae_enable = mHybridAeEnable;
+    /* DevCamDebug metadata processCaptureRequest */
+    if (meta.exists(DEVCAMDEBUG_META_ENABLE)) {
+        mDevCamDebugMetaEnable =
+                meta.find(DEVCAMDEBUG_META_ENABLE).data.u8[0];
+    }
+    /* DevCamDebug metadata end */
 
     //extract CAC info
     if (meta.exists(ANDROID_COLOR_CORRECTION_ABERRATION_MODE)) {
@@ -4510,6 +4523,9 @@
  *   @request_id: request id
  *   @jpegMetadata: additional jpeg metadata
  *   @hybrid_ae_enable: whether hybrid ae is enabled
+ *   // DevCamDebug metadata
+ *   @DevCamDebug_meta_enable: enable DevCamDebug meta
+ *   // DevCamDebug metadata end
  *   @pprocDone: whether internal offline postprocsesing is done
  *
  * RETURN     : camera_metadata_t*
@@ -4524,6 +4540,9 @@
                                  uint8_t pipeline_depth,
                                  uint8_t capture_intent,
                                  uint8_t hybrid_ae_enable,
+                                 /* DevCamDebug metadata translateFromHalMetadata argument */
+                                 uint8_t DevCamDebug_meta_enable,
+                                 /* DevCamDebug metadata end */
                                  bool pprocDone,
                                  uint8_t fwk_cacMode)
 {
@@ -4538,6 +4557,15 @@
     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);
+    /* DevCamDebug metadata translateFromHalMetadata */
+    camMetadata.update(DEVCAMDEBUG_META_ENABLE, &DevCamDebug_meta_enable, 1);
+    IF_META_AVAILABLE(int32_t, DevCamDebug_af_lens_position,
+            CAM_INTF_META_DEV_CAM_AF_LENS_POSITION, metadata) {
+        int32_t fwk_DevCamDebug_af_lens_position = *DevCamDebug_af_lens_position;
+        camMetadata.update(DEVCAMDEBUG_AF_LENS_POSITION, &fwk_DevCamDebug_af_lens_position, 1);
+    }
+    /* DevCamDebug metadata end */
+
 
     IF_META_AVAILABLE(uint32_t, frame_number, CAM_INTF_META_FRAME_NUMBER, metadata) {
         int64_t fwk_frame_number = *frame_number;
@@ -7043,7 +7071,11 @@
        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, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE};
+       ANDROID_BLACK_LEVEL_LOCK, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE,
+       /* DevCamDebug metadata request_keys_basic */
+       DEVCAMDEBUG_META_ENABLE,
+       /* DevCamDebug metadata end */
+       };
 
     size_t request_keys_cnt =
             sizeof(request_keys_basic)/sizeof(request_keys_basic[0]);
@@ -7079,7 +7111,12 @@
        ANDROID_STATISTICS_PREDICTED_COLOR_GAINS, ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM,
        ANDROID_STATISTICS_SCENE_FLICKER, ANDROID_STATISTICS_FACE_RECTANGLES,
        ANDROID_STATISTICS_FACE_SCORES,
-       NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE};
+       NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE,
+       /* DevCamDebug metadata result_keys_basic */
+       DEVCAMDEBUG_META_ENABLE,
+       DEVCAMDEBUG_AF_LENS_POSITION,
+       /* DevCamDebug metadata end */
+       };
     size_t result_keys_cnt =
             sizeof(result_keys_basic)/sizeof(result_keys_basic[0]);
 
diff --git a/QCamera2/HAL3/QCamera3HWI.h b/QCamera2/HAL3/QCamera3HWI.h
index c6859c2..320f8ce 100644
--- a/QCamera2/HAL3/QCamera3HWI.h
+++ b/QCamera2/HAL3/QCamera3HWI.h
@@ -188,7 +188,11 @@
     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, uint8_t hybrid_ae_enable, bool pprocDone, uint8_t fwk_cacMode);
+                            uint8_t capture_intent, uint8_t hybrid_ae_enable,
+                            /* DevCamDebug metadata translateFromHalMetadata augment .h */
+                            uint8_t DevCamDebug_meta_enable,
+                            /* DevCamDebug metadata end */
+                            bool pprocDone, uint8_t fwk_cacMode);
     camera_metadata_t* saveRequestSettings(const CameraMetadata& jpegMetadata,
                             camera3_capture_request_t *request);
     int initParameters();
@@ -396,6 +400,9 @@
         uint8_t fwkCacMode;
         bool shutter_notified;
         uint8_t hybrid_ae_enable;
+        /* DevCamDebug metadata PendingRequestInfo */
+        uint8_t DevCamDebug_meta_enable;
+        /* DevCamDebug metadata end */
     } PendingRequestInfo;
     typedef struct {
         uint32_t frame_number;
@@ -447,6 +454,10 @@
     uint8_t mCaptureIntent;
     uint8_t mCacMode;
     uint8_t mHybridAeEnable;
+    // DevCamDebug metadata internal variable
+    uint8_t mDevCamDebugMetaEnable;
+    /* DevCamDebug metadata end */
+
     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/QCamera2/HAL3/QCamera3VendorTags.cpp b/QCamera2/HAL3/QCamera3VendorTags.cpp
index a84cd76..f0823ac 100644
--- a/QCamera2/HAL3/QCamera3VendorTags.cpp
+++ b/QCamera2/HAL3/QCamera3VendorTags.cpp
@@ -121,7 +121,9 @@
 
 vendor_tag_info_t nexus_experimental_2016[NEXUS_EXPERIMENTAL_2016_END -
         NEXUS_EXPERIMENTAL_2016_START] = {
-   {"3a.hybrid_ae_enable", TYPE_BYTE }
+   {"3a.hybrid_ae_enable", TYPE_BYTE },
+   { "devcamdebug_meta_enable", TYPE_BYTE },
+   { "devcamdebug_af_lens_position", TYPE_INT32 }
 };
 
 vendor_tag_info_t
@@ -185,6 +187,8 @@
 
     //NEXUS_EXPERIMENTAL_2016
     (uint32_t)NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE,
+    (uint32_t)DEVCAMDEBUG_META_ENABLE,
+    (uint32_t)DEVCAMDEBUG_AF_LENS_POSITION,
 
     // QCAMERA3_DUALCAM_LINK_META_DATA
     (uint32_t)QCAMERA3_DUALCAM_LINK_ENABLE,
diff --git a/QCamera2/HAL3/QCamera3VendorTags.h b/QCamera2/HAL3/QCamera3VendorTags.h
index 603f597..56723b2 100644
--- a/QCamera2/HAL3/QCamera3VendorTags.h
+++ b/QCamera2/HAL3/QCamera3VendorTags.h
@@ -143,6 +143,8 @@
     QCAMERA3_SENSOR_META_DATA_END,
 
     NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE = NEXUS_EXPERIMENTAL_2016_START,
+    DEVCAMDEBUG_META_ENABLE,
+    DEVCAMDEBUG_AF_LENS_POSITION,
     NEXUS_EXPERIMENTAL_2016_END,
 
     QCAMERA3_DUALCAM_LINK_ENABLE = QCAMERA3_DUALCAM_LINK_META_DATA_START,
diff --git a/QCamera2/stack/common/cam_intf.h b/QCamera2/stack/common/cam_intf.h
index e57c6f2..3189da1 100644
--- a/QCamera2/stack/common/cam_intf.h
+++ b/QCamera2/stack/common/cam_intf.h
@@ -967,6 +967,10 @@
     INCLUDE(CAM_INTF_PARM_INITIAL_EXPOSURE_INDEX,       uint32_t,                    1);
     INCLUDE(CAM_INTF_PARM_INSTANT_AEC,                  uint8_t,                     1);
     INCLUDE(CAM_INTF_META_HYBRID_AE,                    uint8_t,                     1);
+    /* DevCamDebug metadata CAM_INTF.H */
+    INCLUDE(CAM_INTF_META_DEV_CAM_ENABLE,               uint8_t,                     1);
+    INCLUDE(CAM_INTF_META_DEV_CAM_AF_LENS_POSITION,     int32_t,                     1);
+    /* DevCamDebug metadata end */
 } metadata_data_t;
 
 /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
diff --git a/QCamera2/stack/common/cam_types.h b/QCamera2/stack/common/cam_types.h
index 9539ef1..bda8e56 100644
--- a/QCamera2/stack/common/cam_types.h
+++ b/QCamera2/stack/common/cam_types.h
@@ -2122,6 +2122,10 @@
     CAM_INTF_PARM_INSTANT_AEC,
     /* Whether to enable hybrid ae mode */
     CAM_INTF_META_HYBRID_AE,
+    /* DevCamDebug metadata CAM_TYPES.h */
+    CAM_INTF_META_DEV_CAM_ENABLE,
+    CAM_INTF_META_DEV_CAM_AF_LENS_POSITION,
+    /* DevCamDebug metadata end */
     CAM_INTF_PARM_MAX
 } cam_intf_parm_type_t;