msmcobalt: Update to 07.00.00.253.030

Change-Id: Id862d20ff9373b708d6d3cc7fa4919079d1118e4
diff --git a/msmcobalt/QCamera2/HAL/QCamera2HWI.cpp b/msmcobalt/QCamera2/HAL/QCamera2HWI.cpp
index 047f55c..c0f7736 100644
--- a/msmcobalt/QCamera2/HAL/QCamera2HWI.cpp
+++ b/msmcobalt/QCamera2/HAL/QCamera2HWI.cpp
@@ -1647,6 +1647,7 @@
       mPLastFrameCount(0),
       mPLastFpsTime(0),
       mPFps(0),
+      mLowLightConfigured(false),
       mInstantAecFrameCount(0),
       m_bIntJpegEvtPending(false),
       m_bIntRawEvtPending(false),
@@ -1666,7 +1667,8 @@
       mMetadataMem(NULL),
       mCACDoneReceived(false),
       m_bNeedRestart(false),
-      mBootToMonoTimestampOffset(0)
+      mBootToMonoTimestampOffset(0),
+      bDepthAFCallbacks(true)
 {
 #ifdef TARGET_TS_MAKEUP
     memset(&mFaceRect, -1, sizeof(mFaceRect));
@@ -1974,6 +1976,10 @@
     }
     LOGH("mBootToMonoTimestampOffset = %lld", mBootToMonoTimestampOffset);
 
+    memset(value, 0, sizeof(value));
+    property_get("persist.camera.depth.focus.cb", value, "1");
+    bDepthAFCallbacks = atoi(value);
+
     return NO_ERROR;
 
 error_exit3:
@@ -3955,6 +3961,10 @@
 {
     int32_t rc = NO_ERROR;
 
+    /*Disable Quadra CFA mode*/
+    LOGH("Disabling Quadra CFA mode");
+    mParameters.setQuadraCfaMode(false, true);
+
     if (mAdvancedCaptureConfigured) {
 
         mAdvancedCaptureConfigured = false;
@@ -3972,9 +3982,9 @@
             rc = mParameters.stopAEBracket();
         } else if ((mParameters.isChromaFlashEnabled())
                 || (mFlashConfigured && !mLongshotEnabled)
-                || (mParameters.getLowLightLevel() != CAM_LOW_LIGHT_OFF)
+                || (mLowLightConfigured == true)
                 || (mParameters.getManualCaptureMode() >= CAM_MANUAL_CAPTURE_TYPE_2)) {
-            rc = mParameters.resetFrameCapture(TRUE);
+            rc = mParameters.resetFrameCapture(TRUE, mLowLightConfigured);
         } else if (mParameters.isUbiFocusEnabled() || mParameters.isUbiRefocus()) {
             rc = configureAFBracketing(false);
         } else if (mParameters.isOptiZoomEnabled()) {
@@ -4025,6 +4035,9 @@
         LOGE("Cannot support Advanced capture modes");
         return rc;
     }
+    /*Enable Quadra CFA mode*/
+    LOGH("Enabling Quadra CFA mode");
+    mParameters.setQuadraCfaMode(true, true);
 
     setOutputImageCount(0);
     mInputCount = 0;
@@ -4068,6 +4081,9 @@
             || (mParameters.getLowLightLevel() != CAM_LOW_LIGHT_OFF)
             || (mParameters.getManualCaptureMode() >= CAM_MANUAL_CAPTURE_TYPE_2)) {
         rc = mParameters.configFrameCapture(TRUE);
+        if (mParameters.getLowLightLevel() != CAM_LOW_LIGHT_OFF) {
+            mLowLightConfigured = true;
+        }
     } else if (mFlashNeeded && !mLongshotEnabled) {
         rc = mParameters.configFrameCapture(TRUE);
         mFlashConfigured = true;
@@ -4346,10 +4362,11 @@
         rc = pChannel->stopAdvancedCapture(MM_CAMERA_AF_BRACKETING);
     } else if (mParameters.isChromaFlashEnabled()
             || (mFlashConfigured && !mLongshotEnabled)
-            || (mParameters.getLowLightLevel() != CAM_LOW_LIGHT_OFF)
+            || (mLowLightConfigured == true)
             || (mParameters.getManualCaptureMode() >= CAM_MANUAL_CAPTURE_TYPE_2)) {
         rc = pChannel->stopAdvancedCapture(MM_CAMERA_FRAME_CAPTURE);
         mFlashConfigured = false;
+        mLowLightConfigured = false;
     } else if(mParameters.isHDREnabled()
             || mParameters.isAEBracketEnabled()) {
         rc = pChannel->stopAdvancedCapture(MM_CAMERA_AE_BRACKETING);
@@ -4393,7 +4410,7 @@
         rc = pChannel->startAdvancedCapture(MM_CAMERA_AE_BRACKETING);
     } else if (mParameters.isChromaFlashEnabled()
             || (mFlashNeeded && !mLongshotEnabled)
-            || (mParameters.getLowLightLevel() != CAM_LOW_LIGHT_OFF)
+            || (mLowLightConfigured == true)
             || (mParameters.getManualCaptureMode() >= CAM_MANUAL_CAPTURE_TYPE_2)) {
         cam_capture_frame_config_t config = mParameters.getCaptureFrameConfig();
         rc = pChannel->startAdvancedCapture(MM_CAMERA_FRAME_CAPTURE, &config);
@@ -4928,6 +4945,7 @@
     if (mParameters.isJpegPictureFormat() ||
         mParameters.isNV16PictureFormat() ||
         mParameters.isNV21PictureFormat()) {
+        mParameters.setQuadraCfaMode(false, true);
         rc = stopChannel(QCAMERA_CH_TYPE_CAPTURE);
         if (destroy && (NO_ERROR == rc)) {
             // Destroy camera channel but dont release context
@@ -5350,6 +5368,9 @@
     int rc = NO_ERROR;
 
     QCameraChannel *pChannel = NULL;
+    QCameraChannel *pPreviewChannel = NULL;
+    QCameraStream  *pPreviewStream = NULL;
+    QCameraStream  *pStream = NULL;
 
     //Set rotation value from user settings as Jpeg rotation
     //to configure back-end modules.
@@ -5374,6 +5395,45 @@
         goto end;
     }
 
+    // Check if all preview buffers are mapped before creating
+    // a jpeg session as preview stream buffers are queried during the same
+    pPreviewChannel = m_channels[QCAMERA_CH_TYPE_PREVIEW];
+    if (pPreviewChannel != NULL) {
+        uint32_t numStreams = pPreviewChannel->getNumOfStreams();
+
+        for (uint8_t i = 0 ; i < numStreams ; i++ ) {
+            pStream = pPreviewChannel->getStreamByIndex(i);
+            if (!pStream)
+                continue;
+            if (CAM_STREAM_TYPE_PREVIEW == pStream->getMyType()) {
+                pPreviewStream = pStream;
+                break;
+            }
+        }
+
+        if (pPreviewStream != NULL) {
+            Mutex::Autolock l(mMapLock);
+            QCameraMemory *pMemory = pStream->getStreamBufs();
+            if (!pMemory) {
+                LOGE("Error!! pMemory is NULL");
+                return -ENOMEM;
+            }
+
+            uint8_t waitCnt = 2;
+            while (!pMemory->checkIfAllBuffersMapped() && (waitCnt > 0)) {
+                LOGL(" Waiting for preview buffers to be mapped");
+                mMapCond.waitRelative(
+                        mMapLock, CAMERA_DEFERRED_MAP_BUF_TIMEOUT);
+                LOGL("Wait completed!!");
+                waitCnt--;
+            }
+            // If all buffers are not mapped after retries, assert
+            assert(pMemory->checkIfAllBuffersMapped());
+        } else {
+            assert(pPreviewStream);
+        }
+    }
+
     DeferWorkArgs args;
     memset(&args, 0, sizeof(DeferWorkArgs));
 
@@ -6174,8 +6234,8 @@
         return ret;
     }
     cam_focus_mode_type focusMode = mParameters.getFocusMode();
-    LOGH("[AF_DBG]  focusMode=%d, focusState=%d",
-             focusMode, focus_data.focus_state);
+    LOGH("[AF_DBG]  focusMode=%d, focusState=%d isDepth=%d",
+             focusMode, focus_data.focus_state, focus_data.isDepth);
 
     switch (focusMode) {
     case CAM_FOCUS_MODE_AUTO:
@@ -6245,6 +6305,12 @@
             break;
         }
 
+        if (!bDepthAFCallbacks && focus_data.isDepth &&
+                (focus_data.focus_state == CAM_AF_STATE_PASSIVE_SCAN)) {
+            LOGD("Skip sending scan state to app, if depth focus");
+            break;
+        }
+
         //These are the AF states for which we need to send notification to app in CAF mode.
         //This includes both regular CAF (PASSIVE) events as well as ACTIVE events ( in case
         //AF is triggered while in CAF mode)
@@ -8130,7 +8196,7 @@
             }
         }
 
-        if (mParameters.getofflineRAW()) {
+        if (mParameters.getofflineRAW() && !mParameters.getQuadraCfa()) {
             addChannel(QCAMERA_CH_TYPE_RAW);
         }
     } else {
@@ -8435,38 +8501,53 @@
 
             if (faces_data->landmark_valid) {
                 // Center of left eye
-                faces[i].left_eye[0] = MAP_TO_DRIVER_COORDINATE(
-                        faces_data->landmark_data.face_landmarks[i].left_eye_center.x,
-                        display_dim.width, 2000, -1000);
-                faces[i].left_eye[1] = MAP_TO_DRIVER_COORDINATE(
-                        faces_data->landmark_data.face_landmarks[i].left_eye_center.y,
-                        display_dim.height, 2000, -1000);
+                if (faces_data->landmark_data.face_landmarks[i].is_left_eye_valid) {
+                    faces[i].left_eye[0] = MAP_TO_DRIVER_COORDINATE(
+                            faces_data->landmark_data.face_landmarks[i].left_eye_center.x,
+                            display_dim.width, 2000, -1000);
+                    faces[i].left_eye[1] = MAP_TO_DRIVER_COORDINATE(
+                            faces_data->landmark_data.face_landmarks[i].left_eye_center.y,
+                            display_dim.height, 2000, -1000);
+                } else {
+                    faces[i].left_eye[0] = FACE_INVALID_POINT;
+                    faces[i].left_eye[1] = FACE_INVALID_POINT;
+                }
 
                 // Center of right eye
-                faces[i].right_eye[0] = MAP_TO_DRIVER_COORDINATE(
-                        faces_data->landmark_data.face_landmarks[i].right_eye_center.x,
-                        display_dim.width, 2000, -1000);
-                faces[i].right_eye[1] = MAP_TO_DRIVER_COORDINATE(
-                        faces_data->landmark_data.face_landmarks[i].right_eye_center.y,
-                        display_dim.height, 2000, -1000);
+                if (faces_data->landmark_data.face_landmarks[i].is_right_eye_valid) {
+                    faces[i].right_eye[0] = MAP_TO_DRIVER_COORDINATE(
+                            faces_data->landmark_data.face_landmarks[i].right_eye_center.x,
+                            display_dim.width, 2000, -1000);
+                    faces[i].right_eye[1] = MAP_TO_DRIVER_COORDINATE(
+                            faces_data->landmark_data.face_landmarks[i].right_eye_center.y,
+                            display_dim.height, 2000, -1000);
+                } else {
+                    faces[i].right_eye[0] = FACE_INVALID_POINT;
+                    faces[i].right_eye[1] = FACE_INVALID_POINT;
+                }
 
                 // Center of mouth
-                faces[i].mouth[0] = MAP_TO_DRIVER_COORDINATE(
-                        faces_data->landmark_data.face_landmarks[i].mouth_center.x,
-                        display_dim.width, 2000, -1000);
-                faces[i].mouth[1] = MAP_TO_DRIVER_COORDINATE(
-                        faces_data->landmark_data.face_landmarks[i].mouth_center.y,
-                        display_dim.height, 2000, -1000);
+                if (faces_data->landmark_data.face_landmarks[i].is_mouth_valid) {
+                    faces[i].mouth[0] = MAP_TO_DRIVER_COORDINATE(
+                            faces_data->landmark_data.face_landmarks[i].mouth_center.x,
+                            display_dim.width, 2000, -1000);
+                    faces[i].mouth[1] = MAP_TO_DRIVER_COORDINATE(
+                            faces_data->landmark_data.face_landmarks[i].mouth_center.y,
+                            display_dim.height, 2000, -1000);
+                } else {
+                    faces[i].mouth[0] = FACE_INVALID_POINT;
+                    faces[i].mouth[1] = FACE_INVALID_POINT;
+                }
             } else {
                 // return -2000 if invalid
-                faces[i].left_eye[0] = -2000;
-                faces[i].left_eye[1] = -2000;
+                faces[i].left_eye[0] = FACE_INVALID_POINT;
+                faces[i].left_eye[1] = FACE_INVALID_POINT;
 
-                faces[i].right_eye[0] = -2000;
-                faces[i].right_eye[1] = -2000;
+                faces[i].right_eye[0] = FACE_INVALID_POINT;
+                faces[i].right_eye[1] = FACE_INVALID_POINT;
 
-                faces[i].mouth[0] = -2000;
-                faces[i].mouth[1] = -2000;
+                faces[i].mouth[0] = FACE_INVALID_POINT;
+                faces[i].mouth[1] = FACE_INVALID_POINT;
             }
 
 #ifndef VANILLA_HAL
diff --git a/msmcobalt/QCamera2/HAL/QCamera2HWI.h b/msmcobalt/QCamera2/HAL/QCamera2HWI.h
index 4d9929b..7e4556d 100644
--- a/msmcobalt/QCamera2/HAL/QCamera2HWI.h
+++ b/msmcobalt/QCamera2/HAL/QCamera2HWI.h
@@ -650,6 +650,7 @@
     int mPLastFrameCount;
     nsecs_t mPLastFpsTime;
     double mPFps;
+    bool mLowLightConfigured;
     uint8_t mInstantAecFrameCount;
 
     //eztune variables for communication with eztune server at backend
@@ -791,6 +792,7 @@
     uint32_t mFrameSkipEnd;
     //The offset between BOOTTIME and MONOTONIC timestamps
     nsecs_t mBootToMonoTimestampOffset;
+    bool bDepthAFCallbacks;
 };
 
 }; // namespace qcamera
diff --git a/msmcobalt/QCamera2/HAL/QCamera2HWICallbacks.cpp b/msmcobalt/QCamera2/HAL/QCamera2HWICallbacks.cpp
index dca74fd..537d537 100644
--- a/msmcobalt/QCamera2/HAL/QCamera2HWICallbacks.cpp
+++ b/msmcobalt/QCamera2/HAL/QCamera2HWICallbacks.cpp
@@ -2162,6 +2162,10 @@
                 IF_META_AVAILABLE(uint32_t, focusMode, CAM_INTF_PARM_FOCUS_MODE, pMetaData) {
                     payload->focus_data.focus_mode = (cam_focus_mode_type)(*focusMode);
                 }
+                IF_META_AVAILABLE(uint8_t, isDepthFocus,
+                        CAM_INTF_META_FOCUS_DEPTH_INFO, pMetaData) {
+                    payload->focus_data.isDepth = *isDepthFocus;
+                }
                 int32_t rc = pme->processEvt(QCAMERA_SM_EVT_EVT_INTERNAL, payload);
                 if (rc != NO_ERROR) {
                     LOGW("processEvt focus failed");
diff --git a/msmcobalt/QCamera2/HAL/QCameraMem.cpp b/msmcobalt/QCamera2/HAL/QCameraMem.cpp
index 214f219..2a805a6 100644
--- a/msmcobalt/QCamera2/HAL/QCameraMem.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraMem.cpp
@@ -2108,7 +2108,7 @@
          goto end;
     }
 
-    err = mWindow->set_buffers_geometry(mWindow, mStride, mScanline, mFormat);
+    err = mWindow->set_buffers_geometry(mWindow, mWidth, mHeight, mFormat);
     if (err != 0) {
          LOGE("set_buffers_geometry failed: %s (%d)",
                 strerror(-err), -err);
@@ -2116,14 +2116,6 @@
          goto end;
     }
 
-    err = mWindow->set_crop(mWindow, 0, 0, mWidth, mHeight);
-    if (err != 0) {
-         LOGE("set_crop failed: %s (%d)",
-                strerror(-err), -err);
-         ret = UNKNOWN_ERROR;
-         goto end;
-    }
-
     gralloc_usage = GRALLOC_USAGE_HW_CAMERA_WRITE;
     gralloc_usage |= mUsage;
     err = mWindow->set_usage(mWindow, gralloc_usage);
diff --git a/msmcobalt/QCamera2/HAL/QCameraParameters.cpp b/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
old mode 100644
new mode 100755
index f0a65ba..6472e7d
--- a/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
@@ -3917,6 +3917,51 @@
 }
 
 /*===========================================================================
+ * FUNCTION   : setQuadraCfaMode
+ *
+ * DESCRIPTION: enable or disable Quadra CFA mode
+ *
+ * PARAMETERS :
+ *   @enable : enable: 1; disable 0
+ *   @initCommit: if configuration list needs to be initialized and commited
+ *
+ * RETURN     : int32_t type of status
+ *              NO_ERROR  -- success
+ *              none-zero failure code
+ *==========================================================================*/
+int32_t QCameraParameters::setQuadraCfaMode(uint32_t enable, bool initCommit) {
+
+   int32_t rc = NO_ERROR;
+
+    if (getQuadraCfa()) {
+        if (enable) {
+            setOfflineRAW(TRUE);
+        } else  {
+            setOfflineRAW(FALSE);
+        }
+         if (initCommit) {
+             if (initBatchUpdate(m_pParamBuf) < 0) {
+                 LOGE("Failed to initialize group update table");
+                 return FAILED_TRANSACTION;
+             }
+         }
+         if (ADD_SET_PARAM_ENTRY_TO_BATCH(m_pParamBuf, CAM_INTF_PARM_QUADRA_CFA, enable)) {
+             LOGE("Failed to update Quadra CFA mode");
+             return BAD_VALUE;
+         }
+         if (initCommit) {
+             rc = commitSetBatch();
+             if (rc != NO_ERROR) {
+                 LOGE("Failed to commit Quadra CFA mode");
+                 return rc;
+             }
+         }
+    }
+    LOGI("Quadra CFA mode %d ", enable);
+    return rc;
+}
+
+/*===========================================================================
  * FUNCTION   : setQuadraCFA
  *
  * DESCRIPTION: set Quadra CFA mode
@@ -3957,21 +4002,10 @@
     if (prev_quadracfa == m_bQuadraCfa) {
         LOGD("No change in Quadra CFA mode");
     } else {
-        if (ADD_SET_PARAM_ENTRY_TO_BATCH(m_pParamBuf, CAM_INTF_PARM_QUADRA_CFA, value)) {
-            rc = BAD_VALUE;
-            LOGE("Error sending Quadra CFA set param to modules");
-            return rc;
-        }
-
         if (m_bZslMode && m_bQuadraCfa) {
             m_bNeedRestart = TRUE;
             setZslMode(FALSE);
-        }
-
-        if (m_bQuadraCfa) {
-            setOfflineRAW(TRUE);
-        } else  {
-            setOfflineRAW(FALSE);
+        } else {
             const char *str_val  = params.get(KEY_QC_ZSL);
             int32_t value = lookupAttr(ON_OFF_MODES_MAP, PARAM_MAP_SIZE(ON_OFF_MODES_MAP),
                     str_val);
@@ -6979,10 +7013,10 @@
 
             char zz_prop[PROPERTY_VALUE_MAX];
             memset(zz_prop, 0, sizeof(zz_prop));
-            property_get("persist.camera.zzhdr.video", zz_prop, "0");
+            property_get("persist.camera.hdr.video", zz_prop, "0");
             uint8_t use_zzhdr_video = (uint8_t)atoi(zz_prop);
 
-            if (use_zzhdr_video) {
+            if (use_zzhdr_video == CAM_SENSOR_HDR_ZIGZAG) {
                 LOGH("%s: Using ZZ HDR for video mode", __func__);
                 if (value)
                     value = CAM_SENSOR_HDR_ZIGZAG;
@@ -7648,8 +7682,7 @@
     }
 
     if (isHDREnabled() || m_bAeBracketingEnabled || m_bAFBracketingOn ||
-          m_bOptiZoomOn || m_bReFocusOn || m_LowLightLevel
-          || getManualCaptureMode()) {
+          m_bOptiZoomOn || m_bReFocusOn || getManualCaptureMode()) {
         value = CAM_FLASH_MODE_OFF;
     } else if (isChromaFlashEnabled()) {
         value = CAM_FLASH_MODE_ON;
@@ -7657,13 +7690,7 @@
         value = mFlashValue;
     }
 
-    if (value != CAM_FLASH_MODE_OFF) {
-        configureFlash(m_captureFrameConfig);
-    } else if(isHDREnabled()) {
-        configureHDRBracketing (m_captureFrameConfig);
-    } else if(isAEBracketEnabled()) {
-        configureAEBracketing (m_captureFrameConfig);
-    } else if (m_LowLightLevel) {
+    if (m_LowLightLevel && (value != CAM_FLASH_MODE_ON)) {
         configureLowLight (m_captureFrameConfig);
 
         //Added reset capture type as a last batch for back-end to restore settings.
@@ -7671,6 +7698,12 @@
         m_captureFrameConfig.configs[batch_count].type = CAM_CAPTURE_RESET;
         m_captureFrameConfig.configs[batch_count].num_frames = 0;
         m_captureFrameConfig.num_batch++;
+    } else if (value != CAM_FLASH_MODE_OFF) {
+        configureFlash(m_captureFrameConfig);
+    } else if(isHDREnabled()) {
+        configureHDRBracketing (m_captureFrameConfig);
+    } else if(isAEBracketEnabled()) {
+        configureAEBracketing (m_captureFrameConfig);
     } else if (getManualCaptureMode() >= CAM_MANUAL_CAPTURE_TYPE_2){
         rc = configureManualCapture (m_captureFrameConfig);
         //Added reset capture type as a last batch for back-end to restore settings.
@@ -7705,12 +7738,13 @@
  *
  * PARAMETERS :
  *   @commitSettings : flag to enable or disable commit this this settings
+ *   @lowLightEnabled: flag to indicate if low light scene detected
  *
  * RETURN     : int32_t type of status
  *              NO_ERROR  -- success
  *              none-zero failure code
  *==========================================================================*/
-int32_t QCameraParameters::resetFrameCapture(bool commitSettings)
+int32_t QCameraParameters::resetFrameCapture(bool commitSettings, bool lowLightEnabled)
 {
     int32_t rc = NO_ERROR;
     memset(&m_captureFrameConfig, 0, sizeof(cam_capture_frame_config_t));
@@ -7729,7 +7763,7 @@
         }
         rc = stopAEBracket();
     } else if ((isChromaFlashEnabled()) || (mFlashValue != CAM_FLASH_MODE_OFF)
-            || (getLowLightLevel() != CAM_LOW_LIGHT_OFF)) {
+            || (lowLightEnabled == true)) {
         rc = setToneMapMode(true, false);
         if (rc != NO_ERROR) {
             LOGH("Failed to enable tone map during chroma flash");
@@ -9740,7 +9774,7 @@
     }
 
     if (isHDREnabled() || m_bAeBracketingEnabled || m_bAFBracketingOn ||
-          m_bOptiZoomOn || m_bReFocusOn || m_LowLightLevel || m_bStillMoreOn) {
+          m_bOptiZoomOn || m_bReFocusOn || m_bStillMoreOn) {
         value = CAM_FLASH_MODE_OFF;
     } else if (m_bChromaFlashOn) {
         value = CAM_FLASH_MODE_ON;
@@ -11474,6 +11508,10 @@
     uint32_t faceProcMask = m_nFaceProcMask;
     // set face detection mask
     if (enabled) {
+        if (m_pCapability->max_num_roi == 0) {
+            LOGE("Face detection is not support becuase max number of face is 0");
+            return BAD_VALUE;
+        }
         faceProcMask |= CAM_FACE_PROCESS_MASK_DETECTION;
         if (getRecordingHintValue() > 0) {
             faceProcMask = 0;
diff --git a/msmcobalt/QCamera2/HAL/QCameraParameters.h b/msmcobalt/QCamera2/HAL/QCameraParameters.h
index 4a4fd6e..615be12 100644
--- a/msmcobalt/QCamera2/HAL/QCameraParameters.h
+++ b/msmcobalt/QCamera2/HAL/QCameraParameters.h
@@ -804,7 +804,7 @@
     int32_t configureAEBracketing(cam_capture_frame_config_t &frame_config);
     int32_t configureHDRBracketing(cam_capture_frame_config_t &frame_config);
     int32_t configFrameCapture(bool commitSettings);
-    int32_t resetFrameCapture(bool commitSettings);
+    int32_t resetFrameCapture(bool commitSettings, bool lowLightEnabled);
     cam_still_more_t getStillMoreSettings() {return m_stillmore_config;};
     void setStillMoreSettings(cam_still_more_t stillmore_config)
             {m_stillmore_config = stillmore_config;};
@@ -821,6 +821,7 @@
     bool    isPostProcScaling();
     bool    isLLNoiseEnabled();
     void    setCurPPCount(int8_t count) {mCurPPCount = count;};
+    int32_t setQuadraCfaMode(uint32_t value, bool initCommit);
     int32_t setToneMapMode(uint32_t value, bool initCommit);
     void setTintless(bool enable);
     uint8_t getLongshotStages();
diff --git a/msmcobalt/QCamera2/HAL/QCameraParametersIntf.cpp b/msmcobalt/QCamera2/HAL/QCameraParametersIntf.cpp
index 4534b3a..d1b2cfb 100644
--- a/msmcobalt/QCamera2/HAL/QCameraParametersIntf.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraParametersIntf.cpp
@@ -1106,11 +1106,11 @@
     return mImpl->configFrameCapture(commitSettings);
 }
 
-int32_t QCameraParametersIntf::resetFrameCapture(bool commitSettings)
+int32_t QCameraParametersIntf::resetFrameCapture(bool commitSettings, bool lowLightEnabled)
 {
     Mutex::Autolock lock(mLock);
     CHECK_PARAM_INTF(mImpl);
-    return mImpl->resetFrameCapture(commitSettings);
+    return mImpl->resetFrameCapture(commitSettings,lowLightEnabled);
 }
 
 cam_still_more_t QCameraParametersIntf::getStillMoreSettings()
@@ -1203,6 +1203,13 @@
     mImpl->setCurPPCount(count);
 }
 
+int32_t QCameraParametersIntf::setQuadraCfaMode(uint32_t value, bool initCommit)
+{
+    Mutex::Autolock lock(mLock);
+    CHECK_PARAM_INTF(mImpl);
+    return mImpl->setQuadraCfaMode(value, initCommit);
+}
+
 int32_t QCameraParametersIntf::setToneMapMode(uint32_t value, bool initCommit)
 {
     Mutex::Autolock lock(mLock);
diff --git a/msmcobalt/QCamera2/HAL/QCameraParametersIntf.h b/msmcobalt/QCamera2/HAL/QCameraParametersIntf.h
index d8b8fa3..e4576e3 100644
--- a/msmcobalt/QCamera2/HAL/QCameraParametersIntf.h
+++ b/msmcobalt/QCamera2/HAL/QCameraParametersIntf.h
@@ -243,7 +243,7 @@
     int32_t configureAEBracketing(cam_capture_frame_config_t &frame_config);
     int32_t configureHDRBracketing(cam_capture_frame_config_t &frame_config);
     int32_t configFrameCapture(bool commitSettings);
-    int32_t resetFrameCapture(bool commitSettings);
+    int32_t resetFrameCapture(bool commitSettings, bool lowLightEnabled);
     cam_still_more_t getStillMoreSettings();
     void setStillMoreSettings(cam_still_more_t stillmore_config);
     cam_still_more_t getStillMoreCapability();
@@ -257,6 +257,7 @@
     bool isPostProcScaling();
     bool isLLNoiseEnabled();
     void setCurPPCount(int8_t count);
+    int32_t setQuadraCfaMode(uint32_t value, bool initCommit);
     int32_t setToneMapMode(uint32_t value, bool initCommit);
     void setTintless(bool enable);
     uint8_t getLongshotStages();
diff --git a/msmcobalt/QCamera2/HAL/QCameraPostProc.cpp b/msmcobalt/QCamera2/HAL/QCameraPostProc.cpp
index 48ad35a..8c8cef4 100644
--- a/msmcobalt/QCamera2/HAL/QCameraPostProc.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraPostProc.cpp
@@ -1955,8 +1955,7 @@
                     pStream->isOrignalTypeOf(CAM_STREAM_TYPE_SNAPSHOT) ||
                     pStream->isTypeOf(CAM_STREAM_TYPE_VIDEO) ||
                     pStream->isOrignalTypeOf(CAM_STREAM_TYPE_VIDEO) ||
-                    (m_parent->mParameters.getofflineRAW() &&
-                            pStream->isOrignalTypeOf(CAM_STREAM_TYPE_RAW))) {
+                    pStream->isOrignalTypeOf(CAM_STREAM_TYPE_RAW)) {
                 *main= pStream;
                 *main_image = frame->bufs[i];
             } else if (thumb_stream_needed &&
diff --git a/msmcobalt/QCamera2/HAL/QCameraStateMachine.cpp b/msmcobalt/QCamera2/HAL/QCameraStateMachine.cpp
index f9e85b8..424307b 100644
--- a/msmcobalt/QCamera2/HAL/QCameraStateMachine.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraStateMachine.cpp
@@ -2278,6 +2278,7 @@
             rc = m_parent->stopCaptureChannel(restartPreview);
 
             if (restartPreview && (NO_ERROR == rc)) {
+                m_parent->unconfigureAdvancedCapture();
                 rc = m_parent->preparePreview();
                 if (NO_ERROR == rc) {
                     m_parent->m_bPreviewStarted = true;
diff --git a/msmcobalt/QCamera2/HAL/QCameraStream.cpp b/msmcobalt/QCamera2/HAL/QCameraStream.cpp
index 2dd5f5b..efc02b9 100644
--- a/msmcobalt/QCamera2/HAL/QCameraStream.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraStream.cpp
@@ -1906,6 +1906,14 @@
 {
     int rc = NO_ERROR;
 
+    if (mBufAllocPid != 0) {
+        cond_signal(true);
+        LOGD("wait for buf allocation thread dead");
+        pthread_join(mBufAllocPid, NULL);
+        mBufAllocPid = 0;
+        LOGD("return from buf allocation thread");
+    }
+
     if (mStreamInfo->streaming_mode == CAM_STREAMING_MODE_BATCH) {
         return releaseBatchBufs(NULL);
     }
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp b/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp
old mode 100644
new mode 100755
index 1806e77..ff08c92
--- a/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp
@@ -106,6 +106,15 @@
 
 #define TIMEOUT_NEVER -1
 
+/* Face landmarks indices */
+#define LEFT_EYE_X             0
+#define LEFT_EYE_Y             1
+#define RIGHT_EYE_X            2
+#define RIGHT_EYE_Y            3
+#define MOUTH_X                4
+#define MOUTH_Y                5
+#define TOTAL_LANDMARK_INDICES 6
+
 cam_capability_t *gCamCapability[MM_CAMERA_MAX_NUM_SENSORS];
 const camera_metadata_t *gStaticMetadata[MM_CAMERA_MAX_NUM_SENSORS];
 extern pthread_mutex_t gCamLock;
@@ -117,6 +126,21 @@
     {"Off", CAM_CDS_MODE_OFF},
     {"Auto",CAM_CDS_MODE_AUTO}
 };
+const QCamera3HardwareInterface::QCameraMap<
+        camera_metadata_enum_android_video_hdr_mode_t,
+        cam_video_hdr_mode_t> QCamera3HardwareInterface::VIDEO_HDR_MODES_MAP[] = {
+    { QCAMERA3_VIDEO_HDR_MODE_OFF,  CAM_VIDEO_HDR_MODE_OFF },
+    { QCAMERA3_VIDEO_HDR_MODE_ON,   CAM_VIDEO_HDR_MODE_ON }
+};
+
+
+const QCamera3HardwareInterface::QCameraMap<
+        camera_metadata_enum_android_ir_mode_t,
+        cam_ir_mode_type_t> QCamera3HardwareInterface::IR_MODES_MAP [] = {
+    {QCAMERA3_IR_MODE_OFF,  CAM_IR_MODE_OFF},
+    {QCAMERA3_IR_MODE_ON, CAM_IR_MODE_ON},
+    {QCAMERA3_IR_MODE_AUTO, CAM_IR_MODE_AUTO}
+};
 
 const QCamera3HardwareInterface::QCameraMap<
         camera_metadata_enum_android_control_effect_mode_t,
@@ -3351,39 +3375,19 @@
             }
             mPendingBuffersMap.removeBuf(buffer->buffer);
 
-            bool notifyNow = true;
-            for (pendingRequestIterator j = mPendingRequestsList.begin();
-                    j != mPendingRequestsList.end(); j++) {
-                if (j->frame_number < frame_number) {
-                    notifyNow = false;
-                    break;
-                }
-            }
+            camera3_capture_result result;
+            memset(&result, 0, sizeof(camera3_capture_result));
+            result.frame_number = frame_number;
+            result.result = i->settings;
+            result.input_buffer = i->input_buffer;
+            result.num_output_buffers = 1;
+            result.output_buffers = buffer;
+            result.partial_result = PARTIAL_RESULT_COUNT;
 
-            if (notifyNow) {
-                camera3_capture_result result;
-                memset(&result, 0, sizeof(camera3_capture_result));
-                result.frame_number = frame_number;
-                result.result = i->settings;
-                result.input_buffer = i->input_buffer;
-                result.num_output_buffers = 1;
-                result.output_buffers = buffer;
-                result.partial_result = PARTIAL_RESULT_COUNT;
-
-                mCallbackOps->notify(mCallbackOps, &notify_msg);
-                mCallbackOps->process_capture_result(mCallbackOps, &result);
-                LOGD("Notify reprocess now %d!", frame_number);
-                i = erasePendingRequest(i);
-            } else {
-                // Cache reprocess result for later
-                PendingReprocessResult pendingResult;
-                memset(&pendingResult, 0, sizeof(PendingReprocessResult));
-                pendingResult.notify_msg = notify_msg;
-                pendingResult.buffer = *buffer;
-                pendingResult.frame_number = frame_number;
-                mPendingReprocessResultList.push_back(pendingResult);
-                LOGD("Cache reprocess result %d!", frame_number);
-            }
+            mCallbackOps->notify(mCallbackOps, &notify_msg);
+            mCallbackOps->process_capture_result(mCallbackOps, &result);
+            LOGD("Notify reprocess now %d!", frame_number);
+            i = erasePendingRequest(i);
         } else {
             for (List<RequestedBufferInfo>::iterator j = i->buffers.begin();
                 j != i->buffers.end(); j++) {
@@ -3632,6 +3636,14 @@
             }
         }
 
+        if (meta.exists(QCAMERA3_VIDEO_HDR_MODE)) {
+            cam_video_hdr_mode_t vhdr = (cam_video_hdr_mode_t)
+                    meta.find(QCAMERA3_VIDEO_HDR_MODE).data.i32[0];
+            rc = setVideoHdrMode(mParameters, vhdr);
+            if (rc != NO_ERROR) {
+                LOGE("setVideoHDR is failed");
+            }
+        }
 
         //TODO: validate the arguments, HSV scenemode should have only the
         //advertised fps ranges
@@ -5124,7 +5136,12 @@
                                         landmarks->face_landmarks[i].mouth_center.y);
 
                                 convertLandmarks(landmarks->face_landmarks[i], faceLandmarks+k);
-                                k+= 6;
+                                k+= TOTAL_LANDMARK_INDICES;
+                            }
+                        } else {
+                            for (size_t i = 0; i < numFaces; i++) {
+                                setInvalidLandmarks(faceLandmarks+k);
+                                k+= TOTAL_LANDMARK_INDICES;
                             }
                         }
 
@@ -5542,6 +5559,20 @@
         camMetadata.update(QCAMERA3_CDS_MODE, cds, 1);
     }
 
+    IF_META_AVAILABLE(cam_sensor_hdr_type_t, vhdr, CAM_INTF_PARM_SENSOR_HDR, metadata) {
+        int32_t fwk_hdr;
+        if(*vhdr == CAM_SENSOR_HDR_OFF) {
+            fwk_hdr = QCAMERA3_VIDEO_HDR_MODE_OFF;
+        } else {
+            fwk_hdr = QCAMERA3_VIDEO_HDR_MODE_ON;
+        }
+        camMetadata.update(QCAMERA3_VIDEO_HDR_MODE, &fwk_hdr, 1);
+    }
+
+    IF_META_AVAILABLE(cam_ir_mode_type_t, ir, CAM_INTF_META_IR_MODE, metadata) {
+        camMetadata.update(QCAMERA3_IR_MODE,(int32_t *) &ir, 1);
+    }
+
     // TNR
     IF_META_AVAILABLE(cam_denoise_param_t, tnr, CAM_INTF_PARM_TEMPORAL_DENOISE, metadata) {
         uint8_t tnr_enable       = tnr->denoise_enable;
@@ -6283,12 +6314,50 @@
         cam_face_landmarks_info_t landmark_data,
         int32_t *landmarks)
 {
-    landmarks[0] = (int32_t)landmark_data.left_eye_center.x;
-    landmarks[1] = (int32_t)landmark_data.left_eye_center.y;
-    landmarks[2] = (int32_t)landmark_data.right_eye_center.x;
-    landmarks[3] = (int32_t)landmark_data.right_eye_center.y;
-    landmarks[4] = (int32_t)landmark_data.mouth_center.x;
-    landmarks[5] = (int32_t)landmark_data.mouth_center.y;
+    if (landmark_data.is_left_eye_valid) {
+        landmarks[LEFT_EYE_X] = (int32_t)landmark_data.left_eye_center.x;
+        landmarks[LEFT_EYE_Y] = (int32_t)landmark_data.left_eye_center.y;
+    } else {
+        landmarks[LEFT_EYE_X] = FACE_INVALID_POINT;
+        landmarks[LEFT_EYE_Y] = FACE_INVALID_POINT;
+    }
+
+    if (landmark_data.is_right_eye_valid) {
+        landmarks[RIGHT_EYE_X] = (int32_t)landmark_data.right_eye_center.x;
+        landmarks[RIGHT_EYE_Y] = (int32_t)landmark_data.right_eye_center.y;
+    } else {
+        landmarks[RIGHT_EYE_X] = FACE_INVALID_POINT;
+        landmarks[RIGHT_EYE_Y] = FACE_INVALID_POINT;
+    }
+
+    if (landmark_data.is_mouth_valid) {
+        landmarks[MOUTH_X] = (int32_t)landmark_data.mouth_center.x;
+        landmarks[MOUTH_Y] = (int32_t)landmark_data.mouth_center.y;
+    } else {
+        landmarks[MOUTH_X] = FACE_INVALID_POINT;
+        landmarks[MOUTH_Y] = FACE_INVALID_POINT;
+    }
+}
+
+/*===========================================================================
+ * FUNCTION   : setInvalidLandmarks
+ *
+ * DESCRIPTION: helper method to set invalid landmarks
+ *
+ * PARAMETERS :
+ *   @landmarks : int32_t destination array
+ *
+ *
+ *==========================================================================*/
+void QCamera3HardwareInterface::setInvalidLandmarks(
+        int32_t *landmarks)
+{
+    landmarks[LEFT_EYE_X] = FACE_INVALID_POINT;
+    landmarks[LEFT_EYE_Y] = FACE_INVALID_POINT;
+    landmarks[RIGHT_EYE_X] = FACE_INVALID_POINT;
+    landmarks[RIGHT_EYE_Y] = FACE_INVALID_POINT;
+    landmarks[MOUTH_X] = FACE_INVALID_POINT;
+    landmarks[MOUTH_Y] = FACE_INVALID_POINT;
 }
 
 #define DATA_PTR(MEM_OBJ,INDEX) MEM_OBJ->getPtr( INDEX )
@@ -6867,6 +6936,10 @@
              supportedFaceDetectMode);
 
     int32_t maxFaces = gCamCapability[cameraId]->max_num_roi;
+    /* support mode should be OFF if max number of face is 0 */
+    if (maxFaces <= 0) {
+        supportedFaceDetectMode = 0;
+    }
     Vector<uint8_t> availableFaceDetectModes;
     availableFaceDetectModes.add(ANDROID_STATISTICS_FACE_DETECT_MODE_OFF);
     if (supportedFaceDetectMode == 1) {
@@ -7699,6 +7772,19 @@
     staticInfo.update(QCAMERA3_OPAQUE_RAW_STRIDES, strides.array(),
             strides.size());
 
+    //Video HDR default
+    if ((gCamCapability[cameraId]->qcom_supported_feature_mask) &
+            (CAM_QCOM_FEATURE_STAGGERED_VIDEO_HDR |
+            CAM_QCOM_FEATURE_ZIGZAG_VIDEO_HDR | CAM_QCOM_FEATURE_SENSOR_HDR)) {
+        int32_t vhdr_mode[] = {
+                QCAMERA3_VIDEO_HDR_MODE_OFF,
+                QCAMERA3_VIDEO_HDR_MODE_ON};
+
+        size_t vhdr_mode_count = sizeof(vhdr_mode) / sizeof(int32_t);
+        staticInfo.update(QCAMERA3_AVAILABLE_VIDEO_HDR_MODES,
+                    vhdr_mode, vhdr_mode_count);
+    }
+
     staticInfo.update(QCAMERA3_DUALCAM_CALIB_META_DATA_BLOB,
             (const uint8_t*)&gCamCapability[cameraId]->related_cam_calibration,
             sizeof(gCamCapability[cameraId]->related_cam_calibration));
@@ -7737,6 +7823,23 @@
         LOGW("Warning: ANDROID_SENSOR_OPAQUE_RAW_SIZE is using rough estimation(2 bytes/pixel)");
 #endif
 
+    if (gCamCapability[cameraId]->supported_ir_mode_cnt > 0) {
+        int32_t avail_ir_modes[CAM_IR_MODE_MAX];
+        size = 0;
+        count = CAM_IR_MODE_MAX;
+        count = MIN(gCamCapability[cameraId]->supported_ir_mode_cnt, count);
+        for (size_t i = 0; i < count; i++) {
+            int val = lookupFwkName(IR_MODES_MAP, METADATA_MAP_SIZE(IR_MODES_MAP),
+                    gCamCapability[cameraId]->supported_ir_modes[i]);
+            if (NAME_NOT_FOUND != val) {
+                avail_ir_modes[size] = (int32_t)val;
+                size++;
+            }
+        }
+        staticInfo.update(QCAMERA3_IR_AVAILABLE_MODES,
+                avail_ir_modes, size);
+    }
+
     gStaticMetadata[cameraId] = staticInfo.release();
     return rc;
 }
@@ -8170,6 +8273,10 @@
         optStabMode = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;
         break;
     }
+    // Set CAC to OFF if underlying device doesn't support
+    if (gCamCapability[mCameraId]->aberration_modes_count == 0) {
+        cacMode = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;
+    }
     settings.update(ANDROID_COLOR_CORRECTION_ABERRATION_MODE, &cacMode, 1);
     settings.update(ANDROID_CONTROL_CAPTURE_INTENT, &controlIntent, 1);
     settings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &vsMode, 1);
@@ -8448,6 +8555,14 @@
 
     int32_t mode = cds_mode;
     settings.update(QCAMERA3_CDS_MODE, &mode, 1);
+
+    int32_t hdr_mode = (int32_t)QCAMERA3_VIDEO_HDR_MODE_OFF;
+    settings.update(QCAMERA3_VIDEO_HDR_MODE, &hdr_mode, 1);
+
+    /* IR Mode Default Off */
+    int32_t ir_mode = (int32_t)QCAMERA3_IR_MODE_OFF;
+    settings.update(QCAMERA3_IR_MODE, &ir_mode, 1);
+
     mDefaultMetadata[type] = settings.release();
 
     return mDefaultMetadata[type];
@@ -9544,6 +9659,30 @@
         }
     }
 
+    // Video HDR
+    if (frame_settings.exists(QCAMERA3_VIDEO_HDR_MODE)) {
+        cam_video_hdr_mode_t vhdr = (cam_video_hdr_mode_t)
+                frame_settings.find(QCAMERA3_VIDEO_HDR_MODE).data.i32[0];
+        rc = setVideoHdrMode(mParameters, vhdr);
+        if (rc != NO_ERROR) {
+            LOGE("setVideoHDR is failed");
+        }
+    }
+
+    //IR
+    if(frame_settings.exists(QCAMERA3_IR_MODE)) {
+        cam_ir_mode_type_t fwk_ir = (cam_ir_mode_type_t)
+                frame_settings.find(QCAMERA3_IR_MODE).data.i32[0];
+        if ((CAM_IR_MODE_MAX <= fwk_ir) || (0 > fwk_ir)) {
+            LOGE("Invalid IR mode %d!", fwk_ir);
+        } else {
+            if (ADD_SET_PARAM_ENTRY_TO_BATCH(hal_metadata,
+                    CAM_INTF_META_IR_MODE, fwk_ir)) {
+                rc = BAD_VALUE;
+            }
+        }
+    }
+
     // TNR
     if (frame_settings.exists(QCAMERA3_TEMPORAL_DENOISE_ENABLE) &&
         frame_settings.exists(QCAMERA3_TEMPORAL_DENOISE_PROCESS_TYPE)) {
@@ -10067,6 +10206,67 @@
 }
 
 /*===========================================================================
+ * FUNCTION   : setVideoHdrMode
+ *
+ * DESCRIPTION: Set Video HDR mode from frameworks set metadata
+ *
+ * PARAMETERS :
+ *      @hal_metadata: hal metadata structure
+ *      @metaMode: QCAMERA3_VIDEO_HDR_MODE
+ *
+ * RETURN     : None
+ *==========================================================================*/
+int32_t QCamera3HardwareInterface::setVideoHdrMode(
+        metadata_buffer_t *hal_metadata, cam_video_hdr_mode_t vhdr)
+{
+    int32_t rc = NO_ERROR;
+    if ((CAM_VIDEO_HDR_MODE_MAX <= (vhdr)) || (0 > (vhdr))) {
+        LOGE("%s: Invalid Video HDR mode %d!", __func__, vhdr);
+        rc = BAD_VALUE;
+    } else {
+        cam_sensor_hdr_type_t vhdr_type = CAM_SENSOR_HDR_MAX;
+        if(vhdr == QCAMERA3_VIDEO_HDR_MODE_OFF) {
+            LOGD("Setting HDR mode Off");
+            vhdr_type = CAM_SENSOR_HDR_OFF;
+        } else {
+            char video_hdr_prop[PROPERTY_VALUE_MAX];
+            memset(video_hdr_prop, 0, sizeof(video_hdr_prop));
+            property_get("persist.camera.hdr.video", video_hdr_prop, "3");
+            uint8_t use_hdr_video = (uint8_t)atoi(video_hdr_prop);
+            if ((gCamCapability[mCameraId]->qcom_supported_feature_mask &
+                    CAM_QCOM_FEATURE_SENSOR_HDR) &&
+                    (use_hdr_video == CAM_SENSOR_HDR_IN_SENSOR)) {
+                LOGD("Setting HDR mode In Sensor");
+                vhdr_type = CAM_SENSOR_HDR_IN_SENSOR;
+            }
+            if ((gCamCapability[mCameraId]->qcom_supported_feature_mask &
+                    CAM_QCOM_FEATURE_ZIGZAG_VIDEO_HDR) &&
+                    (use_hdr_video == CAM_SENSOR_HDR_ZIGZAG)) {
+                LOGD("Setting HDR mode Zigzag");
+                vhdr_type = CAM_SENSOR_HDR_ZIGZAG;
+            }
+            if ((gCamCapability[mCameraId]->qcom_supported_feature_mask &
+                    CAM_QCOM_FEATURE_STAGGERED_VIDEO_HDR) &&
+                    (use_hdr_video == CAM_SENSOR_HDR_STAGGERED)) {
+                LOGD("Setting HDR mode Staggered");
+                vhdr_type = CAM_SENSOR_HDR_STAGGERED;
+            }
+            if(vhdr_type == CAM_SENSOR_HDR_MAX) {
+                LOGD("HDR mode not supported");
+                rc = BAD_VALUE;
+            }
+        }
+        if(rc == NO_ERROR) {
+            if (ADD_SET_PARAM_ENTRY_TO_BATCH(hal_metadata,
+                    CAM_INTF_PARM_SENSOR_HDR, vhdr_type)) {
+                rc = BAD_VALUE;
+            }
+        }
+    }
+    return rc;
+}
+
+/*===========================================================================
  * FUNCTION   : needRotationReprocess
  *
  * DESCRIPTION: if rotation needs to be done by reprocess in pp
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3HWI.h b/msmcobalt/QCamera2/HAL3/QCamera3HWI.h
old mode 100644
new mode 100755
index c398dac..3f7fb03
--- a/msmcobalt/QCamera2/HAL3/QCamera3HWI.h
+++ b/msmcobalt/QCamera2/HAL3/QCamera3HWI.h
@@ -44,6 +44,7 @@
 #include "QCamera3Mem.h"
 #include "QCameraPerf.h"
 #include "QCameraCommon.h"
+#include "QCamera3VendorTags.h"
 
 extern "C" {
 #include "mm_camera_interface.h"
@@ -163,7 +164,6 @@
     static void convertFromRegions(cam_area_t &roi, const camera_metadata_t *settings,
                                    uint32_t tag);
     static bool resetIfNeededROI(cam_area_t* roi, const cam_crop_region_t* scalerCropRegion);
-    static void convertLandmarks(cam_face_landmarks_info_t face, int32_t* landmarks);
     static int32_t getSensorSensitivity(int32_t iso_mode);
 
     double computeNoiseModelEntryS(int32_t sensitivity);
@@ -314,6 +314,8 @@
             metadata_buffer_t *hal_metadata);
     int32_t extractSceneMode(const CameraMetadata &frame_settings, uint8_t metaMode,
             metadata_buffer_t *hal_metadata);
+    int32_t setVideoHdrMode(metadata_buffer_t *hal_metadata,
+            cam_video_hdr_mode_t vhdr);
     int32_t numOfSizesOnEncoder(const camera3_stream_configuration_t *streamList,
             const cam_dimension_t &maxViewfinderSize);
 
@@ -338,6 +340,9 @@
     static bool supportBurstCapture(uint32_t cameraId);
     int32_t setBundleInfo();
 
+    static void convertLandmarks(cam_face_landmarks_info_t face, int32_t* landmarks);
+    static void setInvalidLandmarks(int32_t* landmarks);
+
     static void setPAAFSupport(cam_feature_mask_t& feature_mask,
             cam_stream_type_t stream_type,
             cam_color_filter_arrangement_t filter_arrangement);
@@ -514,11 +519,14 @@
             cam_focus_calibration_t> FOCUS_CALIBRATION_MAP[];
     static const QCameraMap<camera_metadata_enum_android_sensor_test_pattern_mode_t,
             cam_test_pattern_mode_t> TEST_PATTERN_MAP[];
+    static const QCameraMap<camera_metadata_enum_android_video_hdr_mode_t,
+            cam_video_hdr_mode_t> VIDEO_HDR_MODES_MAP[];
     static const QCameraMap<camera_metadata_enum_android_sensor_reference_illuminant1_t,
             cam_illuminat_t> REFERENCE_ILLUMINANT_MAP[];
     static const QCameraMap<int32_t,
             cam_hfr_mode_t> HFR_MODE_MAP[];
-
+    static const QCameraMap<camera_metadata_enum_android_ir_mode_t,
+            cam_ir_mode_type_t> IR_MODES_MAP[];
     static const QCameraPropMap CDS_MAP[];
 
     pendingRequestIterator erasePendingRequest(pendingRequestIterator i);
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp
old mode 100644
new mode 100755
index 95eff54..7ad77b2
--- a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp
+++ b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp
@@ -54,8 +54,10 @@
         QCAMERA3_DUALCAM_LINK_META_DATA_END,
         QCAMERA3_DUALCAM_CALIB_META_DATA_END,
         QCAMERA3_HAL_PRIVATEDATA_END,
-        QCAMERA3_JPEG_ENCODE_CROP_END
-} ;
+        QCAMERA3_JPEG_ENCODE_CROP_END,
+        QCAMERA3_VIDEO_HDR_END,
+        QCAMERA3_IR_END
+};
 
 typedef struct vendor_tag_info {
     const char *tag_name;
@@ -75,7 +77,9 @@
     "org.codeaurora.qcamera3.dualcam_link_meta_data",
     "org.codeaurora.qcamera3.dualcam_calib_meta_data",
     "org.codeaurora.qcamera3.hal_private_data",
-    "org.codeaurora.qcamera3.jpeg_encode_crop"
+    "org.codeaurora.qcamera3.jpeg_encode_crop",
+    "org.codeaurora.qcamera3.video_hdr_mode",
+    "org.codeaurora.qcamera3.ir"
 };
 
 vendor_tag_info_t qcamera3_privatedata[QCAMERA3_PRIVATEDATA_END - QCAMERA3_PRIVATEDATA_START] = {
@@ -150,6 +154,18 @@
     { "roi",    TYPE_INT32}
 };
 
+vendor_tag_info_t qcamera3_video_hdr[QCAMERA3_VIDEO_HDR_END -
+        QCAMERA3_VIDEO_HDR_START] = {
+    { "vhdr_mode", TYPE_INT32 },
+    { "vhdr_supported_modes", TYPE_INT32 }
+};
+
+vendor_tag_info_t qcamera3_ir[QCAMERA3_IR_END -
+        QCAMERA3_IR_START] = {
+    { "ir_mode", TYPE_INT32 },
+    { "ir_supported_modes", TYPE_INT32}
+};
+
 vendor_tag_info_t *qcamera3_tag_info[QCAMERA3_SECTIONS_END -
         VENDOR_SECTION] = {
     qcamera3_privatedata,
@@ -163,7 +179,9 @@
     qcamera3_dualcam_link_meta_data,
     qcamera3_dualcam_calib_meta_data,
     qcamera3_hal_privatedata,
-    qcamera3_jpep_encode_crop
+    qcamera3_jpep_encode_crop,
+    qcamera3_video_hdr,
+    qcamera3_ir
 };
 
 uint32_t qcamera3_all_tags[] = {
@@ -211,8 +229,15 @@
     // QCAMERA3_JPEG_ENCODE_CROP
     (uint32_t)QCAMERA3_JPEG_ENCODE_CROP_ENABLE,
     (uint32_t)QCAMERA3_JPEG_ENCODE_CROP_RECT,
-    (uint32_t)QCAMERA3_JPEG_ENCODE_CROP_ROI
+    (uint32_t)QCAMERA3_JPEG_ENCODE_CROP_ROI,
 
+    // QCAMERA3_VIDEO_HDR
+    (uint32_t)QCAMERA3_VIDEO_HDR_MODE,
+    (uint32_t)QCAMERA3_AVAILABLE_VIDEO_HDR_MODES,
+
+    // QCAMERA3_IR_MODE_ENABLE
+    (uint32_t)QCAMERA3_IR_MODE,
+    (uint32_t)QCAMERA3_IR_AVAILABLE_MODES
 };
 
 const vendor_tag_ops_t* QCamera3VendorTags::Ops = NULL;
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h
old mode 100644
new mode 100755
index 7f02afa..31fafd9
--- a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h
+++ b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h
@@ -48,6 +48,8 @@
     QCAMERA3_DUALCAM_CALIB_META_DATA,
     QCAMERA3_HAL_PRIVATEDATA,
     QCAMERA3_JPEG_ENCODE_CROP,
+    QCAMERA3_VIDEO_HDR,
+    QCAMERA3_IR,
     QCAMERA3_SECTIONS_END
 };
 
@@ -63,7 +65,9 @@
     QCAMERA3_DUALCAM_LINK_META_DATA_START = QCAMERA3_DUALCAM_LINK_META_DATA << 16,
     QCAMERA3_DUALCAM_CALIB_META_DATA_START = QCAMERA3_DUALCAM_CALIB_META_DATA << 16,
     QCAMERA3_HAL_PRIVATEDATA_START = QCAMERA3_HAL_PRIVATEDATA << 16,
-    QCAMERA3_JPEG_ENCODE_CROP_START = QCAMERA3_JPEG_ENCODE_CROP << 16
+    QCAMERA3_JPEG_ENCODE_CROP_START = QCAMERA3_JPEG_ENCODE_CROP << 16,
+    QCAMERA3_VIDEO_HDR_START = QCAMERA3_VIDEO_HDR << 16,
+    QCAMERA3_IR_START = QCAMERA3_IR << 16
 };
 
 enum qcamera3_ext_tags {
@@ -181,7 +185,15 @@
        roi[3] = height
     */
     QCAMERA3_JPEG_ENCODE_CROP_ROI,
-    QCAMERA3_JPEG_ENCODE_CROP_END
+    QCAMERA3_JPEG_ENCODE_CROP_END,
+
+    QCAMERA3_VIDEO_HDR_MODE = QCAMERA3_VIDEO_HDR_START,
+    QCAMERA3_AVAILABLE_VIDEO_HDR_MODES,
+    QCAMERA3_VIDEO_HDR_END,
+
+    QCAMERA3_IR_MODE = QCAMERA3_IR_START,
+    QCAMERA3_IR_AVAILABLE_MODES,
+    QCAMERA3_IR_END
 };
 
 // QCAMERA3_OPAQUE_RAW_FORMAT
@@ -190,6 +202,20 @@
     QCAMERA3_OPAQUE_RAW_FORMAT_MIPI
 } qcamera3_ext_opaque_raw_format_t;
 
+
+// QCAMERA3_VIDEO_HDR_MODE
+typedef enum camera_metadata_enum_android_video_hdr_mode {
+    QCAMERA3_VIDEO_HDR_MODE_OFF,
+    QCAMERA3_VIDEO_HDR_MODE_ON
+} camera_metadata_enum_android_video_hdr_mode_t;
+
+// QCAMERA3_IR_MODE
+typedef enum camera_metadata_enum_android_ir_mode {
+    QCAMERA3_IR_MODE_OFF,
+    QCAMERA3_IR_MODE_ON,
+    QCAMERA3_IR_MODE_AUTO
+} camera_metadata_enum_android_ir_mode_t;
+
 class QCamera3VendorTags {
 
 public:
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.cpp
index b9fa5e1..df6ab62 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.cpp
@@ -78,6 +78,9 @@
         int camera_id, int new_status)
 {
     /* Stub function */
+    if (callbacks == NULL) {
+        LOGD("Parameters are NULL %d %d", camera_id, new_status);
+    }
 }
 
 static void torch_mode_status_change(
@@ -85,6 +88,9 @@
         const char* camera_id, int new_status)
 {
     /* Stub function */
+    if((callbacks == NULL) || (camera_id == NULL)) {
+        LOGD("Parameters are NULL %d", new_status);
+    }
 }
 
 static void Notify(
@@ -92,6 +98,9 @@
         const camera3_notify_msg *msg)
 {
     /* Stub function */
+    if((cb == NULL) || (msg == NULL)) {
+        LOGD("Parameters are NULL ");
+    }
 }
 
 static void ProcessCaptureResult(
@@ -104,9 +113,10 @@
     extern int req_sent;
     extern int preview_buffer_allocated;
     extern int video_buffer_allocated;
-    double elapsedTime;
     int num;
-    struct timeval end_time;
+    if(cb == NULL) {
+        LOGD("callback returned is NULL");
+    }
     LOGD("Cam Capture Result Callback %d and %d",
             result->num_output_buffers, mCamHal3Base->mFrameCount);
     if (mCamHal3Base->mTestCaseSelected == MENU_START_PREVIEW ||
@@ -196,12 +206,32 @@
     my_test_obj->module_cb.camera_device_status_change = &camera_device_status_change;
     my_if_handle->set_callbacks(&(my_test_obj->module_cb));
     my_if_handle->get_camera_info(0, &(mLibHandle->test_obj.cam_info));
+    camcap_info = mLibHandle->test_obj.cam_info;
+    hal3app_cam_settings = (camcap_info.static_camera_characteristics);
+    display_capability();
     return numCam;
     EXIT:
     return rc;
 
 }
 
+void CameraHAL3Base::display_capability()
+{
+    ALOGE("Camera Here");
+    int i,j;
+    int *available_ir_modes = NULL, *available_svhdr_mode = NULL, count_stream;
+    if(hal3app_cam_settings.exists(QCAMERA3_IR_AVAILABLE_MODES)) {
+        ALOGE("\n mrad check1 ");
+        entry_hal3app = hal3app_cam_settings.find(QCAMERA3_IR_AVAILABLE_MODES);
+        available_ir_modes = (int *) malloc((entry_hal3app.count)*sizeof(int ));
+        for(i =0;i < (int)entry_hal3app.count; i++){
+                    available_ir_modes[i] = entry_hal3app.data.i32[i];
+            ALOGE("\n mrad cap %d ", available_ir_modes[i]);
+
+        }
+    }
+}
+
 int CameraHAL3Base::hal3appCameraLibOpen(int camid)
 {
     int rc;
@@ -242,8 +272,6 @@
         int camid,
         hal3_camera_test_obj_t *my_test_obj)
 {
-    int rc = 0;
-    int numCam;
     camera_module_t *my_if_handle = my_hal3_app->hal3_lib.halModule_t;
     my_if_handle->common.methods->open(&(my_if_handle->common), "0",
             reinterpret_cast<hw_device_t**>(&(my_test_obj->device)));
@@ -305,12 +333,19 @@
 {
     extern int req_sent;
     int testCaseEndComplete = 0;
-    int CaptureRequestSent = 0;
     if (w == 0 || h == 0) {
         printf("\n Frame dimension is wrong");
         return -1;
     }
     if ( mPreviewtestCase != NULL) {
+        if(testcase == MENU_TOGGLE_IR_MODE) {
+            ALOGE("\n IR mode requested is :%d", ir_mode);
+            mPreviewtestCase->ir_mode = ir_mode;
+        }
+        if(testcase == MENU_TOGGLE_SVHDR_MODE) {
+            ALOGE("\n SVHDR mode requested is :%d", svhdr_mode);
+            mPreviewtestCase->svhdr_mode = svhdr_mode;
+        }
         return 0;
     }
     else {
@@ -331,6 +366,7 @@
             capture_received = 0; mSecElapsed = 1;
             snapshot_buffer = -1; mFrameCount = 0;
             mPreviewtestCase->width = w; mPreviewtestCase->height = h;
+            mPreviewtestCase->ir_mode = 0; mPreviewtestCase->svhdr_mode = 0;
             mPreviewtestCase->initTest(mLibHandle,
                     (int) MENU_START_PREVIEW, camid, w, h);
             testCaseEndComplete = 1;
@@ -343,14 +379,14 @@
 {
     extern int req_sent;
     int testCaseEndComplete = 0;
-    int CaptureRequestSent = 0;
     if (w == 0 || h == 0) {
         printf("\n Frame dimension is wrong");
         return -1;
     }
 
     if (mVideotestCase != NULL) {
-            return 0;
+        LOGD("testcase is : %d", testcase);
+        return 0;
     }
     else {
         testCaseEndComplete = 0;
@@ -382,6 +418,9 @@
 int CameraHAL3Base::hal3appRawCaptureInit(hal3_camera_lib_test *handle, int camid, int req_cap)
 {
     int testCaseEndComplete = 0;
+    if(handle == NULL) {
+        LOGE("Camera Handle is NULL");
+    }
     if (mSnapShotRunning != 1) {
         hal3appCheckStream(MENU_START_RAW_CAPTURE, camid);
     }
@@ -407,6 +446,9 @@
         int camid, int req_cap)
 {
     int testCaseEndComplete = 0;
+    if(handle == NULL) {
+        LOGE("Camera Handle is NULL");
+    }
     if (mSnapShotRunning != 1) {
         hal3appCheckStream(MENU_START_CAPTURE, camid);
     }
@@ -427,21 +469,5 @@
     return 0;
 }
 
-void CameraHAL3Base::hal3appCamCapabilityGet(hal3_camera_lib_test *handle, int camid)
-{
-    camera_module_t *my_if_handle = ((handle->app_obj).hal3_lib).halModule_t;
-    hal3_camera_test_obj_t *test_obj_handle = &(handle->test_obj);
-    camera_metadata_entry entry_hal3app;
-    camera_info info;
-    int i = 0, count = 0, j = 0;
-    long int num = 0;
-    int32_t *available_hdr = NULL, *available_svhdr = NULL, *available_ir = NULL;
-    android::CameraMetadata hal3_cam_settings;
-    printf("\n Number of Cameras are : %d and %p", camid, &(test_obj_handle->cam_info));
-    my_if_handle->get_camera_info(camid, &(test_obj_handle->cam_info));
-    info = test_obj_handle->cam_info;
-    hal3_cam_settings = (info.static_camera_characteristics);
-}
-
 }
 
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.h b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.h
index 2b24816..0c42e08 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.h
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Base.h
@@ -43,6 +43,7 @@
 #include <stdio.h>
 #include <pthread.h>
 #include <poll.h>
+#include "QCamera3VendorTags.h"
 
 extern "C" {
 #include "mm_camera_dbg.h"
@@ -150,7 +151,11 @@
     int mPreviewRunning;
     int mVideoRunning;
     int mSnapShotRunning;
-
+    bool ir_mode;
+    bool svhdr_mode;
+    camera_info camcap_info;
+    camera_metadata_entry entry_hal3app;
+    android::CameraMetadata hal3app_cam_settings;
     int hal3appCamInitialize(int camid, hal3_camera_test_obj_t *my_test_obj);
     void hal3appCamCapabilityGet(hal3_camera_lib_test *handle,int camid);
     int hal3appCameraLibOpen(int );
@@ -160,6 +165,7 @@
              hal3_camera_test_obj_t *);
     int hal3appCameraPreviewInit(int, int, int, int);
     int hal3appCameraVideoInit(int, int camid, int w, int h);
+    void display_capability();
     int hal3appCameraCaptureInit(hal3_camera_lib_test *, int, int);
     int hal3appRawCaptureInit(hal3_camera_lib_test *handle, int camid, int );
     int hal3appCameraTestLoad();
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.cpp
index 13e46f9..6a6ab60 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.cpp
@@ -39,6 +39,8 @@
     {MENU_START_VIDEO,               "To Start Video"},
     {MENU_START_CAPTURE,             "To Capture"},
     {MENU_START_RAW_CAPTURE,         "To Raw Capture"},
+    {MENU_TOGGLE_IR_MODE,            "Toggle IR Mode"},
+    {MENU_TOGGLE_SVHDR_MODE,         "Toggle SVHDR Mode"},
     {MENU_EXIT,                      "EXIT"},
 };
 
@@ -52,21 +54,18 @@
 
 MainTestContext::MainTestContext()
 {
-    int i = 0;
     mTestRunning = false;
     mCamHal3Base = NULL;
+    irmode = 0;
+    svhdrmode = 0;
 }
 
 int MainTestContext::hal3appGetUserEvent()
 {
-    char tc_buf[3];
     int choice;
     int rc = 0, req_capture = 0;
-    int num_testcase = MENU_EXIT+1;
-    int submenu_choice, num;
     int preview_restart;
-    static int prev_menu_choice;
-    uint8_t camid, num_of_cameras;
+    uint8_t num_of_cameras;
     if (mCamHal3Base != NULL) {
         delete mCamHal3Base;
     }
@@ -107,7 +106,7 @@
 
             case MENU_START_CAPTURE:
                 hal3appDisplaySnapshotMenu();
-                req_capture = 3; preview_restart = 0;
+                req_capture = 1; preview_restart = 0;
                 if (mCamHal3Base->mPreviewRunning == 1) {
                     preview_restart = 1;
                 }
@@ -130,6 +129,34 @@
                 mCamHal3Base->mSnapShotRunning = 1;
             break;
 
+            case MENU_TOGGLE_IR_MODE:
+                 if(mCamHal3Base->mPreviewRunning == NULL)
+                    printf(" Cant set IR/SVHDR mode in preview mode only");
+                 else {
+                     irmode = !irmode;
+                     printf("\n Switching IR/SVHDR mode to %s",(irmode ? "On" : "Off"));
+                     ALOGE("\n Switching IR/SVHDR mode to %s and %d",
+                             (irmode ? "On" : "Off"),irmode);
+                     mCamHal3Base->ir_mode = irmode;
+                     mCamHal3Base->hal3appCameraPreviewInit(MENU_TOGGLE_IR_MODE,
+                             mCamHal3Base->mCameraIndex, PREVIEW_WIDTH, PREVIEW_HEIGHT);
+                 }
+            break;
+
+            case MENU_TOGGLE_SVHDR_MODE:
+                 if(mCamHal3Base->mPreviewRunning == NULL)
+                    printf(" Cant set IR/SVHDR mode in preview mode only");
+                 else {
+                     svhdrmode = !svhdrmode;
+                     printf("\n Switching IR/SVHDR mode to %s",(svhdrmode ? "On" : "Off"));
+                     ALOGE("\n Switching IR/SVHDR mode to %s and %d",
+                             (svhdrmode ? "On" : "Off"),svhdrmode);
+                     mCamHal3Base->svhdr_mode = svhdrmode;
+                     mCamHal3Base->hal3appCameraPreviewInit(MENU_TOGGLE_SVHDR_MODE,
+                             mCamHal3Base->mCameraIndex, PREVIEW_WIDTH, PREVIEW_HEIGHT);
+                 }
+            break;
+
             case MENU_EXIT:
                 hal3appDisplayExitMenu();
             break;
@@ -206,7 +233,6 @@
 
 void MainTestContext::hal3appDisplayRawCaptureMenu()
 {
-    int req_cap;
     printf("\n");
     printf("===========================================\n");
     printf("Testing RAW Camera Capture on Different Resolution::\n");
@@ -215,7 +241,6 @@
 
 void MainTestContext::hal3appDisplaySnapshotMenu()
 {
-    int req_cap;
     printf("\n");
     printf("===========================================\n");
     printf("Testing Normal Camera Capture on Resolution 5344 X 4008\n");
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.h b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.h
index 1201cfd..5e88f62 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.h
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3MainTestContext.h
@@ -42,6 +42,8 @@
     MENU_START_VIDEO,
     MENU_START_CAPTURE,
     MENU_START_RAW_CAPTURE,
+    MENU_TOGGLE_IR_MODE,
+    MENU_TOGGLE_SVHDR_MODE,
     MENU_EXIT
 } menu_id;
 
@@ -51,12 +53,12 @@
 } HAL3TEST_BASE_MENU_TBL_T;
 
 typedef struct {
-    char * menu_name;
+    const char * menu_name;
 } HAL3TEST_SENSOR_MENU_TBL_T;
 
 typedef struct {
     menu_id main_menu;
-    char * menu_name;
+    const char * menu_name;
 } CAMERA_BASE_MENU_TBL_T;
 
 class CameraHAL3Base;
@@ -64,6 +66,8 @@
 {
     int choice;
     bool mTestRunning;
+    bool irmode;
+    bool svhdrmode;
 public:
     MainTestContext();
     int hal3appGetUserEvent();
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.cpp
index 34693ad..38b371d 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.cpp
@@ -47,7 +47,9 @@
     mPreviewHandle(NULL),
     mCaptureHandle(NULL),
     mPreviewStream(NULL),
-    nobuffer(0)
+    nobuffer(0),
+    ir_mode(0),
+    svhdr_mode(0)
 {
 
 }
@@ -57,7 +59,7 @@
 {
     int i;
     CamObj_handle = handle; thread_exit = 0; test_case_end = 0;
-    LOGD("\n buffer thread created %d and %d ", w, h);
+    LOGD("\n buffer thread created for testcase %d  %d and %d ",testcase, w, h);
     configurePreviewStream(&(handle->test_obj) , camid, w, h);
     LOGD("\n preview stream configured");
     constructDefaultRequest(&(handle->test_obj), camid);
@@ -78,6 +80,7 @@
 void QCameraHAL3PreviewTest::snapshotCaptureRequest(hal3_camera_lib_test *handle,
         int testcase, int camid, int w, int h)
 {
+    LOGD("Requested Capture Sizes for testcase:%d are :%d  X %d",testcase, w, h);
     captureRequestRepeat(handle, camid, MENU_START_CAPTURE);
     pthread_mutex_unlock(&mCaptureRequestLock);
 }
@@ -102,6 +105,7 @@
         hal3_camera_test_obj_t *my_test_obj, int camid)
 {
     camera3_device_t *device_handle = my_test_obj->device;
+    LOGD("Camera ID : %d",camid);
     mMetaDataPtr[0]= device_handle->ops->construct_default_request_settings(my_test_obj->device,
             CAMERA3_TEMPLATE_PREVIEW);
     mMetaDataPtr[1] = device_handle->ops->construct_default_request_settings(my_test_obj->device,
@@ -111,16 +115,17 @@
 void QCameraHAL3PreviewTest::captureRequestRepeat(
         hal3_camera_lib_test *my_hal3test_obj, int camid, int testcase)
 {
-    struct timeval current_time;
     int num1, num2;
-    double total_elapsedTime;
+    int ir_mode_changed;
+    int svhdr_mode_changed;
+    int32_t set_svhdr_mode;
+    int32_t set_ir_mode;
     hal3_camera_test_obj_t *my_test_obj = &(my_hal3test_obj->test_obj);
     camera3_device_t *device_handle = my_test_obj->device;
-    int buffer_id;
 
     if (testcase == MENU_START_PREVIEW) {
         if (PreviewQueue.empty()) {
-            LOGE("no preview buffer");
+            LOGE("no preview buffer for CamID : %d", camid);
         }
         else {
             if (test_case_end == 0) {
@@ -129,9 +134,45 @@
                 num2 = PreviewQueue.front();
                 PreviewQueue.pop_front();
                 num1 = mRequest.frame_number;
-                if (num1 < 2) {
+                ir_mode_changed = get_ir_mode(ir_mode);
+                svhdr_mode_changed = get_svhdr_mode(svhdr_mode);
+                ALOGE("setting IR mode :%d",ir_mode_changed);
+                ALOGE("setting SVHDR mode :%d",svhdr_mode_changed);
+                if (num1 < 1) {
                     (mRequest).settings = mMetaDataPtr[0];
                 }
+                else if(ir_mode_changed == 1) {
+                    hal3app_preview_settings = mMetaDataPtr[0];
+                    if(ir_mode == 0) {
+                        ALOGE("setting IR mode off");
+                        set_ir_mode = (int32_t)QCAMERA3_IR_MODE_OFF;
+                        //set_svhdr_mode = (int32_t)QCAMERA3_VIDEO_HDR_MODE_OFF;
+                    }
+                    else {
+                        ALOGE("setting IR mode On");
+                        set_ir_mode = (int32_t)QCAMERA3_IR_MODE_ON;
+                        //set_svhdr_mode = (int32_t)QCAMERA3_VIDEO_HDR_MODE_ON;
+                    }
+                    hal3app_preview_settings.update(QCAMERA3_IR_MODE, &set_ir_mode, 1);
+                    //hal3app_preview_settings.update(QCAMERA3_VIDEO_HDR_MODE, &set_svhdr_mode, 1);
+                    (mRequest).settings = hal3app_preview_settings.release();
+                }
+                else if(svhdr_mode_changed == 1) {
+                    hal3app_preview_settings = mMetaDataPtr[0];
+                    if(svhdr_mode == 0) {
+                        ALOGE("setting HDR mode off");
+                        //set_ir_mode = (int32_t)ANDROID_IR_MODE_OFF;
+                        set_svhdr_mode = (int32_t)QCAMERA3_VIDEO_HDR_MODE_OFF;
+                    }
+                    else {
+                        ALOGE("setting HDR mode On");
+                        //set_ir_mode = (int32_t)ANDROID_IR_MODE_ON;
+                        set_svhdr_mode = (int32_t)QCAMERA3_VIDEO_HDR_MODE_ON;
+                    }
+                    //hal3app_preview_settings.update(QCAMERA3_IR_MODE, &set_ir_mode, 0);
+                    hal3app_preview_settings.update(QCAMERA3_VIDEO_HDR_MODE, &set_svhdr_mode, 1);
+                    (mRequest).settings = hal3app_preview_settings.release();
+                }
                 else {
                     (mRequest).settings = NULL;
                 }
@@ -168,12 +209,11 @@
 void QCameraHAL3PreviewTest::previewTestEnd(
         hal3_camera_lib_test *my_hal3test_obj, int camid)
 {
-    buffer_thread_msg_t msg;
     test_case_end = 1;
     hal3_camera_test_obj_t *my_test_obj = &(my_hal3test_obj->test_obj);
     camera3_device_t *device_handle = my_test_obj->device;
     device_handle->ops->flush(my_test_obj->device);
-    LOGD("%s Closing Camera", __func__);
+    LOGD("%s Closing Camera %d", __func__, camid);
     ioctl(mPreviewMeminfo.ion_fd, ION_IOC_FREE, &mPreviewMeminfo.ion_handle);
     close(mPreviewMeminfo.ion_fd);
     mPreviewMeminfo.ion_fd = -1;
@@ -194,10 +234,35 @@
 bool QCameraHAL3PreviewTest::previewProcessThreadCreate(
         hal3_camera_lib_test *handle)
 {
+    if(handle == NULL) {
+        LOGD("Camera Hanle is NULL");
+    }
     processThreadCreate(this, MENU_START_PREVIEW);
     return 1;
 }
 
+int QCameraHAL3PreviewTest::get_ir_mode(int ir_mode)
+{
+    static int prev_irmode;
+    if(ir_mode == prev_irmode)
+        return 0;
+    else {
+        prev_irmode = ir_mode;
+        return 1;
+    }
+}
+
+int QCameraHAL3PreviewTest::get_svhdr_mode(int hdr_mode)
+{
+    static int prev_hdrmode;
+    if(hdr_mode == prev_hdrmode)
+        return 0;
+    else {
+        prev_hdrmode = hdr_mode;
+        return 1;
+    }
+}
+
 QCameraHAL3PreviewTest::~QCameraHAL3PreviewTest()
 {
 
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.h b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.h
index ae687cd..09be281 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.h
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3PreviewTest.h
@@ -45,6 +45,7 @@
     camera3_stream_t *mPreviewStream;
     camera3_stream_t *mSnapshotStream;
     camera3_capture_request mRequest;
+    android::CameraMetadata hal3app_preview_settings;
     camera3_stream_buffer_t mPreviewStreamBuffs;
     camera3_stream_buffer_t mSnapshotStreamBuffs;
     camera3_stream_configuration mPreviewConfig;
@@ -53,7 +54,8 @@
     int height;
     int nobuffer;
     int mPipelineDepthPreview;
-
+    bool ir_mode;
+    bool svhdr_mode;
     QCameraHAL3PreviewTest(int cameraIndex);
     void configurePreviewStream(hal3_camera_test_obj_t *my_test_obj, int camid,
             int w, int h);
@@ -71,6 +73,8 @@
     void previewTestEnd(hal3_camera_lib_test *my_hal3test_obj, int camid);
     void snapshotAllocateBuffers(int, int );
     virtual ~QCameraHAL3PreviewTest();
+    int get_ir_mode(int ir_mode);
+    int get_svhdr_mode(int hdr_mode);
 };
 
     void * hal3appPreviewProcessBuffers(void *);
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3RawSnapshotTest.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3RawSnapshotTest.cpp
index f7e05a4..51634a5 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3RawSnapshotTest.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3RawSnapshotTest.cpp
@@ -47,9 +47,8 @@
 void QCameraHAL3RawSnapshotTest::initTest(hal3_camera_lib_test *handle,
         int testcase, int camid, int w, int h)
 {
-    int i; fcount_captured = 0;
     RawSnapshot_CamObj_handle = handle;
-    LOGD("\n Raw buffer thread created");
+    LOGD("\n Raw buffer thread created for testcase : %d", testcase);
     configureRawSnapshotStream(&(handle->test_obj), camid, w, h);
     constructDefaultRequest(&(handle->test_obj), 0);
     LOGD("\n Raw Snapshot Default stream setting read");
@@ -65,6 +64,7 @@
         hal3_camera_test_obj_t *my_test_obj, int camid)
 {
     camera3_device_t *device_handle = my_test_obj->device;
+    LOGD("Camera ID : %d",camid);
     mMetaDataPtr[0] = device_handle->ops->construct_default_request_settings(
             my_test_obj->device, CAMERA3_TEMPLATE_PREVIEW);
     mMetaDataPtr[1] = device_handle->ops->construct_default_request_settings(
@@ -74,8 +74,8 @@
 void QCameraHAL3RawSnapshotTest::configureRawSnapshotStream(hal3_camera_test_obj_t *my_test_obj,
                                     int camid, int w, int h)
 {
-    camera3_stream_t *r_stream, *p_stream;
     camera3_device_t *device_handle = my_test_obj->device;
+    LOGD(" configureSnapshotStream testcase dim :%d  X %d", w, h);
     mPreviewStream = new camera3_stream_t;
     mRawSnapshotStream = new camera3_stream_t;
 
@@ -98,7 +98,6 @@
         hal3_camera_test_obj_t *my_test_obj, int camid)
 {
     int width, height;
-    static int num = 1;
 
     camera3_device_t *device_handle = my_test_obj->device;
     width = mRawSnapshotStream->width;
@@ -114,7 +113,7 @@
     mRawSnapshotStreamBuffs.release_fence = -1;
     mRawSnapshotStreamBuffs.acquire_fence = -1;
     mRequest.output_buffers = &(mRawSnapshotStreamBuffs);
-    LOGD("Calling HAL3APP capture request ");
+    LOGD("Calling HAL3APP capture request for camid : %d", camid);
     device_handle->ops->process_capture_request(my_test_obj->device, &(mRequest));
 }
 
@@ -154,7 +153,7 @@
     hal3_camera_test_obj_t *my_test_obj = &(my_hal3test_obj->test_obj);
     camera3_device_t *device_handle = my_test_obj->device;
     device_handle->ops->flush(my_test_obj->device);
-    LOGD("%s Closing Camera", __func__);
+    LOGD("%s Closing Camera %d", __func__, camid);
     /* Free the Allocated ION Memory */
     ioctl(mRawCaptureMemInfo.ion_fd, ION_IOC_FREE, &mRawCaptureMemInfo.ion_handle);
     close(mRawCaptureMemInfo.ion_fd);
@@ -178,7 +177,7 @@
     buffer_thread_t thread;
     pthread_attr_t attr;
     if (pipe(pfd) < 0) {
-        LOGE("%s: Error in creating the pipe", __func__);
+        LOGE("%s:Test:%d Error in creating the pipe", __func__, testcase_id);
     }
     pthread_attr_init(&attr);
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -205,6 +204,9 @@
 void QCameraHAL3RawSnapshotTest::captureRequestRepeat(
         hal3_camera_lib_test *my_hal3test_obj, int camid, int testcase)
 {
+    if(my_hal3test_obj == NULL) {
+        LOGD("camid :%d and testcase : %d handle is NULL", camid, testcase);
+    }
 }
 
 void * rawProcessBuffers(void *data) {
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3SnapshotTest.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3SnapshotTest.cpp
index 1ef3c54..b6af0c9 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3SnapshotTest.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3SnapshotTest.cpp
@@ -47,9 +47,9 @@
 void QCameraHAL3SnapshotTest::initTest(hal3_camera_lib_test *handle,
         int testcase, int camid, int w, int h)
 {
-    int i;
     fcount_captured = 0;
     Snapshot_CamObj_handle = handle;
+    LOGD("\ntestcase %d  %d and %d ",testcase, w, h);
     configureSnapshotStream(&(handle->test_obj), camid, w, h);
 
     constructDefaultRequest(&(handle->test_obj), 0);
@@ -66,6 +66,7 @@
         hal3_camera_test_obj_t *my_test_obj, int camid)
 {
     camera3_device_t *device_handle = my_test_obj->device;
+    LOGD("Camera ID : %d",camid);
     mMetaDataPtr[0]= device_handle->ops->construct_default_request_settings(my_test_obj->device,
             CAMERA3_TEMPLATE_PREVIEW);
     mMetaDataPtr[1] = device_handle->ops->construct_default_request_settings(my_test_obj->device,
@@ -75,8 +76,8 @@
 void QCameraHAL3SnapshotTest::configureSnapshotStream(hal3_camera_test_obj_t *my_test_obj,
         int camid, int w, int h)
 {
-    camera3_stream_t *s_stream, *p_stream;
     camera3_device_t *device_handle = my_test_obj->device;
+    LOGD(" configureSnapshotStream testcase dim :%d  X %d", w, h);
     mPreviewStream = new camera3_stream_t;
     mSnapshotStream = new camera3_stream_t;
 
@@ -110,7 +111,7 @@
     mSnapshotStreamBuffs.release_fence = -1;
     mSnapshotStreamBuffs.acquire_fence = -1;
     mRequest.output_buffers = &(mSnapshotStreamBuffs);
-    LOGD("Calling HAL3APP capture request ");
+    LOGD("Calling HAL3APP capture request for camid : %d", camid);
     device_handle->ops->process_capture_request(my_test_obj->device, &(mRequest));
     (mRequest.frame_number)++;
 }
@@ -152,7 +153,7 @@
     hal3_camera_test_obj_t *my_test_obj = &(my_hal3test_obj->test_obj);
     camera3_device_t *device_handle = my_test_obj->device;
     device_handle->ops->flush(my_test_obj->device);
-    LOGD("%s Closing Camera", __func__);
+    LOGD("%s Closing Camera %d", __func__, camid);
     ioctl(mCaptureMemInfo.ion_fd, ION_IOC_FREE, &mCaptureMemInfo.ion_handle);
     close(mCaptureMemInfo.ion_fd);
     mCaptureMemInfo.ion_fd = -1;
@@ -173,7 +174,7 @@
     buffer_thread_t thread;
     pthread_attr_t attr;
     if (pipe(pfd) < 0) {
-        LOGE("%s: Error in creating the pipe", __func__);
+        LOGE("%s:Test:%d Error in creating the pipe", __func__, testcase_id);
     }
     pthread_attr_init(&attr);
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -250,6 +251,9 @@
 void QCameraHAL3SnapshotTest::captureRequestRepeat(
         hal3_camera_lib_test *my_hal3test_obj, int camid, int testcase)
 {
+    if(my_hal3test_obj == NULL) {
+        LOGD("camid :%d and testcase : %d handle is NULL", camid, testcase);
+    }
 }
 
 QCameraHAL3SnapshotTest::~QCameraHAL3SnapshotTest()
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Test.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Test.cpp
index fc27a34..4eea68a 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Test.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3Test.cpp
@@ -42,6 +42,7 @@
 camera3_stream_t *QCameraHAL3Test::initStream(int streamtype,
         int camid, int w, int h, int usage, int format, int dataspace)
 {
+    LOGD("Stream init for Camera : %d", camid);
     requested_stream =  new camera3_stream_t;
     memset(requested_stream, 0, sizeof(camera3_stream_t));
 
@@ -63,7 +64,6 @@
 camera3_stream_configuration QCameraHAL3Test::configureStream(
         int opmode, int num_streams)
 {
-    int i;
     camera3_stream_configuration requested_config;
     requested_config.operation_mode  = opmode;
     requested_config.num_streams = num_streams;
@@ -86,6 +86,7 @@
 {
     camera3_capture_request request_settings;
     request_settings.input_buffer = NULL;
+    LOGD("Number of buffer sent : %d", num_buffer);
     request_settings.num_output_buffers = 1;
     request_settings.output_buffers = stream_buffs;
     return request_settings;
@@ -94,12 +95,10 @@
 native_handle_t *QCameraHAL3Test::allocateBuffers(int width, int height,
         hal3_camtest_meminfo_t *req_meminfo)
 {
-    struct ion_handle_data handle_data;
     struct ion_allocation_data alloc;
     struct ion_fd_data ion_info_fd;
     int main_ion_fd = -1, rc;
     size_t buf_size;
-    void *data = NULL;
     native_handle_t *nh_test;
     main_ion_fd = open("/dev/ion", O_RDONLY);
     if (main_ion_fd <= 0) {
@@ -141,7 +140,9 @@
 void QCameraHAL3Test::captureRequestRepeat(
         hal3_camera_lib_test *my_hal3test_obj, int camid, int testcase)
 {
-
+    if(my_hal3test_obj == NULL) {
+        LOGE("TestCase : %d Camera:%d Handle is NULL", testcase, camid);
+    }
 }
 
 bool QCameraHAL3Test::processThreadCreate(
@@ -185,9 +186,6 @@
     testcase = thread->testcase;
     QCameraHAL3Test *obj;
     obj = (QCameraHAL3Test *)thread->data_obj;
-    struct pollfd pollfds;
-    int32_t num_of_fds = 1;
-    int32_t ready = 0;
     while(!thread_exit) {
         pthread_mutex_lock(&thread->mutex);
         clock_gettime(CLOCK_REALTIME, &ts1);
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.cpp b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.cpp
index bca887c..3a97f4b 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.cpp
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.cpp
@@ -49,7 +49,8 @@
     QCameraHAL3Test(0),
     mVideoHandle(NULL),
     mCaptureHandle(NULL),
-    mVideoStream(NULL)
+    mVideoStream(NULL),
+    mCameraId(camid)
 {
 
 }
@@ -60,7 +61,7 @@
     int i;
     CamObj_handle = handle; thread_exit = 0;
     test_case_end = 0;
-    LOGD("\n buffer thread created");
+    LOGD("\n buffer thread created for testcase %d  %d and %d ",testcase, w, h);
     configureVideoStream(&(handle->test_obj), camid, w, h);
     LOGD("\n video stream configured");
     constructDefaultRequest(&(handle->test_obj), camid);
@@ -83,7 +84,7 @@
 void QCameraHAL3VideoTest::snapshotCaptureRequest(hal3_camera_lib_test *handle,
         int testcase, int camid, int w, int h)
 {
-
+    LOGD("Requested Capture Sizes for testcase:%d are :%d  X %d",testcase, w, h);
     captureRequestRepeat(handle, camid, MENU_START_CAPTURE);
     pthread_mutex_unlock(&mCaptureRequestLock);
 }
@@ -109,6 +110,7 @@
         hal3_camera_test_obj_t *my_test_obj, int camid)
 {
     camera3_device_t *device_handle = my_test_obj->device;
+    LOGD("Camera ID : %d",camid);
     mMetaDataPtr[0] = device_handle->ops->construct_default_request_settings(
             my_test_obj->device, CAMERA3_TEMPLATE_VIDEO_RECORD);
     mMetaDataPtr[1] = device_handle->ops->construct_default_request_settings(my_test_obj->device,
@@ -120,14 +122,12 @@
 void QCameraHAL3VideoTest::captureRequestRepeat(
         hal3_camera_lib_test *my_hal3test_obj, int camid, int testcase)
 {
-    struct timeval current_time;
     int num1, num2;
-    double total_elapsedTime;
     hal3_camera_test_obj_t *my_test_obj = &(my_hal3test_obj->test_obj);
     camera3_device_t *device_handle = my_test_obj->device;
     if (testcase == MENU_START_VIDEO) {
         if (VideoQueue.empty()) {
-            LOGE("no Video buffer");
+            LOGE("no Video buffer for CamID : %d", camid);
         }
         else {
             if (test_case_end == 0) {
@@ -174,12 +174,11 @@
 void QCameraHAL3VideoTest::videoTestEnd(
                     hal3_camera_lib_test *my_hal3test_obj, int camid)
 {
-    buffer_thread_msg_t msg;
     test_case_end = 1;
     hal3_camera_test_obj_t *my_test_obj = &(my_hal3test_obj->test_obj);
     camera3_device_t *device_handle = my_test_obj->device;
     device_handle->ops->flush(my_test_obj->device);
-    LOGD("%s Closing Camera", __func__);
+    LOGD("%s Closing Camera %d", __func__, camid);
     ioctl(mVideoMeminfo.ion_fd, ION_IOC_FREE, &mVideoMeminfo.ion_handle);
     close(mVideoMeminfo.ion_fd);
     mVideoMeminfo.ion_fd = -1;
@@ -199,6 +198,9 @@
 
 bool QCameraHAL3VideoTest::videoProcessThreadCreate(
                     hal3_camera_lib_test *handle) {
+    if(handle == NULL) {
+        LOGD("Camera Hanle is NULL");
+    }
     processThreadCreate(this, MENU_START_VIDEO);
     return 1;
 }
diff --git a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.h b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.h
index b4d609a..a0617ed 100644
--- a/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.h
+++ b/msmcobalt/QCamera2/HAL3/test/QCameraHAL3VideoTest.h
@@ -56,6 +56,7 @@
     int height;
     int nobuffer;
     int mPipelineDepthVideo;
+    int mCameraId;
 
     QCameraHAL3VideoTest(int cameraIndex);
 
diff --git a/msmcobalt/QCamera2/stack/common/cam_intf.h b/msmcobalt/QCamera2/stack/common/cam_intf.h
old mode 100644
new mode 100755
index da442c5..941d59c
--- a/msmcobalt/QCamera2/stack/common/cam_intf.h
+++ b/msmcobalt/QCamera2/stack/common/cam_intf.h
@@ -557,6 +557,9 @@
     cam_format_t supported_meta_raw_fmts[CAM_FORMAT_MAX];
     cam_dimension_t raw_meta_dim[MAX_SIZES_CNT];
     cam_sub_format_type_t sub_fmt[CAM_FORMAT_SUBTYPE_MAX];
+    /* Supported IR Mode */
+    size_t supported_ir_mode_cnt;
+    cam_ir_mode_type_t supported_ir_modes[CAM_IR_MODE_MAX];
 } cam_capability_t;
 
 typedef enum {
@@ -969,6 +972,7 @@
     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,        uint32_t,                    1);
     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,             uint32_t,                    1);
     INCLUDE(CAM_INTF_META_TONEMAP_MODE,                 uint32_t,                    1);
+    INCLUDE(CAM_INTF_META_IR_MODE,                      cam_ir_mode_type_t,          1);
     INCLUDE(CAM_INTF_META_STREAM_ID,                    cam_stream_ID_t,             1);
     INCLUDE(CAM_INTF_PARM_STATS_DEBUG_MASK,             uint32_t,                    1);
     INCLUDE(CAM_INTF_PARM_STATS_AF_PAAF,                uint32_t,                    1);
@@ -1008,6 +1012,7 @@
     INCLUDE(CAM_INTF_META_REPROCESS_FLAGS,              uint8_t,                     1);
     INCLUDE(CAM_INTF_PARM_JPEG_ENCODE_CROP,             cam_stream_crop_info_t,      1);
     INCLUDE(CAM_INTF_PARM_JPEG_SCALE_DIMENSION,         cam_dimension_t,             1);
+    INCLUDE(CAM_INTF_META_FOCUS_DEPTH_INFO,             uint8_t,                     1);
 } metadata_data_t;
 
 /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
diff --git a/msmcobalt/QCamera2/stack/common/cam_types.h b/msmcobalt/QCamera2/stack/common/cam_types.h
old mode 100644
new mode 100755
index 38c1435..559796a
--- a/msmcobalt/QCamera2/stack/common/cam_types.h
+++ b/msmcobalt/QCamera2/stack/common/cam_types.h
@@ -867,12 +867,27 @@
 } cam_cds_mode_type_t;
 
 typedef enum {
+    CAM_IR_MODE_OFF,
+    CAM_IR_MODE_ON,
+    CAM_IR_MODE_AUTO,
+    CAM_IR_MODE_MAX
+} cam_ir_mode_type_t;
+
+typedef enum {
     CAM_SENSOR_HDR_OFF,
     CAM_SENSOR_HDR_IN_SENSOR = 1,
     CAM_SENSOR_HDR_ZIGZAG,
+    CAM_SENSOR_HDR_STAGGERED,
     CAM_SENSOR_HDR_MAX,
 } cam_sensor_hdr_type_t;
 
+typedef enum {
+    CAM_VIDEO_HDR_MODE_OFF,
+    CAM_VIDEO_HDR_MODE_ON,
+    CAM_VIDEO_HDR_MODE_MAX,
+} cam_video_hdr_mode_t;
+
+
 typedef struct  {
     int32_t left;
     int32_t top;
@@ -1062,6 +1077,9 @@
 #define CAM_FACE_PROCESS_MASK_SMILE         (1U<<4)
 #define CAM_FACE_PROCESS_MASK_GAZE          (1U<<5)
 
+/* Keep this in sync with invalid landmark value : system/core/include/system/camera.h */
+#define FACE_INVALID_POINT -2000
+
 typedef struct {
     uint32_t fd_mode;          /* mask of face process */
     uint32_t num_fd;
@@ -1168,8 +1186,11 @@
 } cam_face_contour_data_t;
 
 typedef struct {
+    uint8_t is_left_eye_valid;
     cam_coordinate_type_t left_eye_center;  /* coordinate of center of left eye */
+    uint8_t is_right_eye_valid;
     cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */
+    uint8_t is_mouth_valid;
     cam_coordinate_type_t mouth_center;     /* coordinate of center of mouth */
 } cam_face_landmarks_info_t;
 
@@ -1367,6 +1388,7 @@
     cam_focus_mode_type focus_mode;        /* focus mode from backend */
     int32_t focus_pos;
     cam_af_flush_info_t flush_info;
+    uint8_t isDepth;
 } cam_auto_focus_data_t;
 
 typedef struct {
@@ -2203,6 +2225,9 @@
     /* Number of streams and size of streams in
        current configuration for pic res*/
     CAM_INTF_META_STREAM_INFO_FOR_PIC_RES,
+    CAM_INTF_META_FOCUS_DEPTH_INFO,
+    /* Operation Mode for IR */
+    CAM_INTF_META_IR_MODE,
     CAM_INTF_PARM_MAX
 } cam_intf_parm_type_t;
 
@@ -2426,6 +2451,8 @@
 #define CAM_QCOM_FEATURE_PAAF           (((cam_feature_mask_t)1UL)<<32)
 #define CAM_QCOM_FEATURE_QUADRA_CFA     (((cam_feature_mask_t)1UL)<<33)
 #define CAM_QTI_FEATURE_PPEISCORE       (((cam_feature_mask_t)1UL)<<34)
+#define CAM_QCOM_FEATURE_ZIGZAG_VIDEO_HDR (((cam_feature_mask_t)1UL)<<35)
+#define CAM_QCOM_FEATURE_STAGGERED_VIDEO_HDR (((cam_feature_mask_t)1UL)<<36)
 #define CAM_QCOM_FEATURE_PP_SUPERSET    (CAM_QCOM_FEATURE_DENOISE2D|CAM_QCOM_FEATURE_CROP|\
                                          CAM_QCOM_FEATURE_ROTATION|CAM_QCOM_FEATURE_SHARPNESS|\
                                          CAM_QCOM_FEATURE_SCALE|CAM_QCOM_FEATURE_CAC|\
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_app.h b/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_app.h
index a78a332..1b206e4 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_app.h
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_app.h
@@ -241,6 +241,7 @@
     cam_denoise_param_t reproc_wnr;
     int8_t enable_CAC;
     int8_t enable_EZTune;
+    int8_t enable_ir;
     mm_camera_queue_t pp_frames;
     mm_camera_stream_t *reproc_stream;
     metadata_buffer_t *metadata;
@@ -317,6 +318,7 @@
     MM_CAMERA_LIB_WNR_ENABLE,
     MM_CAMERA_LIB_SET_TINTLESS,
     MM_CAMERA_LIB_EZTUNE_ENABLE,
+    MM_CAMERA_LIB_IRMODE,
 } mm_camera_lib_commands;
 
 typedef struct {
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_main_menu.h b/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_main_menu.h
index faf9453..e996078 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_main_menu.h
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/inc/mm_qcamera_main_menu.h
@@ -55,7 +55,7 @@
   SET_TINTLESS_ENABLE,
   SET_TINTLESS_DISABLE,
   SET_EXP_METERING,
-  GET_CTRL_VALUE,
+  TOGGLE_IRLED,
   TOGGLE_EZTUNE,
   SET_ISO,
   BRIGHTNESS_GOTO_SUBMENU,
@@ -86,7 +86,7 @@
   ACTION_SET_TINTLESS_ENABLE,
   ACTION_SET_TINTLESS_DISABLE,
   ACTION_SET_EXP_METERING,
-  ACTION_GET_CTRL_VALUE,
+  ACTION_TOGGLE_IR_MODE,
   ACTION_TOGGLE_AFR,
   ACTION_TOGGLE_EZTUNE,
   ACTION_SET_ISO,
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_app.c b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_app.c
index 5d845b4..482dfb9 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_app.c
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_app.c
@@ -1550,11 +1550,41 @@
 
     test_obj->reproc_wnr = param;
     LOGE("WNR enabled: %d",  enable);
+ERROR:
+    return rc;
+}
+
+
+int setIRMode(mm_camera_test_obj_t *test_obj, cam_ir_mode_type_t ir_mode)
+{
+    int rc = MM_CAMERA_OK;
+
+    rc = initBatchUpdate(test_obj);
+    if (rc != MM_CAMERA_OK) {
+        LOGE("Batch camera parameter update failed\n");
+        goto ERROR;
+    }
+
+    if (ADD_SET_PARAM_ENTRY_TO_BATCH(test_obj->parm_buf.mem_info.data,
+            CAM_INTF_META_IR_MODE, ir_mode)) {
+        LOGE("Flash parameter not added to batch\n");
+        rc = -1;
+        goto ERROR;
+    }
+
+    rc = commitSetBatch(test_obj);
+    if (rc != MM_CAMERA_OK) {
+        LOGE("Batch parameters commit failed\n");
+        goto ERROR;
+    }
+
+    LOGE("IR LED set to: %d",  (int)ir_mode);
 
 ERROR:
     return rc;
 }
 
+
 int setEZTune(mm_camera_test_obj_t *test_obj, uint8_t enable)
 {
     test_obj->enable_EZTune = enable;
@@ -1905,6 +1935,21 @@
                 }
             }
             break;
+
+        case MM_CAMERA_LIB_IRMODE:
+            if ( NULL != in_data) {
+                int enable_ir = *(( int * )in_data);
+                if (enable_ir != handle->test_obj.enable_ir) {
+                    handle->test_obj.enable_ir = enable_ir;
+                    rc = setIRMode(&handle->test_obj, enable_ir);
+                    if (rc != MM_CAMERA_OK) {
+                        LOGE("setZoom() err=%d\n",
+                                    rc);
+                        goto EXIT;
+                    }
+                }
+            }
+            break;
         case MM_CAMERA_LIB_FLASH:
             if ( NULL != in_data ) {
                 cam_flash_mode_t flash = *(( int * )in_data);
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
index 29c2cd0..6e78467 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
@@ -89,7 +89,7 @@
   {SET_TINTLESS_ENABLE,        "Set Tintless Enable"},
   {SET_TINTLESS_DISABLE,       "Set Tintless Disable"},
   {SET_EXP_METERING,           "Set exposure metering mode"},
-  {GET_CTRL_VALUE,             "Get control value menu"},
+  {TOGGLE_IRLED,               "Toggle IR Mode, Default is Off"},
   {TOGGLE_EZTUNE,              "Toggle EZtune. Default EZTune Off"},
   {SET_ISO,                    "ISO changes."},
   {BRIGHTNESS_GOTO_SUBMENU,    "Brightness changes."},
@@ -324,12 +324,6 @@
           next_menu_id = MENU_ID_EXPMETERINGCHANGE;
           LOGD("next_menu_id = MENU_ID_EXPMETERINGCHANGE = %d\n", next_menu_id);
           break;
-
-        case GET_CTRL_VALUE:
-          next_menu_id = MENU_ID_GET_CTRL_VALUE;
-          LOGD("next_menu_id = MENU_ID_GET_CTRL_VALUE = %d\n", next_menu_id);
-          break;
-
         case BRIGHTNESS_GOTO_SUBMENU:
           next_menu_id = MENU_ID_BRIGHTNESSCHANGE;
           LOGD("next_menu_id = MENU_ID_BRIGHTNESSCHANGE = %d\n", next_menu_id);
@@ -351,6 +345,10 @@
           * action_id_ptr = ACTION_TOGGLE_EZTUNE;
           LOGD("next_menu_id = MENU_ID_TOGGLE EZTUNE = %d\n", next_menu_id);
           break;
+        case TOGGLE_IRLED:
+          * action_id_ptr = ACTION_TOGGLE_IR_MODE;
+          LOGD("next_menu_id = MENU_ID_TOGGLE IRLED = %d\n", next_menu_id);
+          break;
 
         case SET_ISO:
           next_menu_id = MENU_ID_ISOCHANGE;
@@ -470,19 +468,6 @@
       }
       break;
 
-    case MENU_ID_GET_CTRL_VALUE:
-      printf("MENU_ID_GET_CTRL_VALUE\n");
-      * action_id_ptr = ACTION_GET_CTRL_VALUE;
-      if (output_to_event > 0 &&
-        output_to_event <= (int)(sizeof(get_ctrl_tbl)/sizeof(get_ctrl_tbl[0]))) {
-          next_menu_id = MENU_ID_MAIN;
-          * action_param = output_to_event;
-      }
-      else {
-        next_menu_id = current_menu_id;
-      }
-      break;
-
     case MENU_ID_BRIGHTNESSCHANGE:
       switch (output_to_event) {
         case INC_BRIGHTNESS:
@@ -1651,6 +1636,7 @@
     uint8_t previewing = 0;
     int isZSL = 0;
     int isezTune = 0;
+    int isirmode = 0;
     uint8_t wnr_enabled = 0;
     mm_camera_lib_handle lib_handle;
     int num_cameras;
@@ -1782,11 +1768,6 @@
                 set_exp_metering(&lib_handle, action_param);
                 break;
 
-            case ACTION_GET_CTRL_VALUE:
-                LOGD("Selection for getting control value\n");
-                get_ctrl_value(action_param);
-                break;
-
             case ACTION_BRIGHTNESS_INCREASE:
                 printf("Increase brightness\n");
                 increase_brightness(&lib_handle);
@@ -1852,6 +1833,26 @@
                 }
                 break;
 
+            case ACTION_TOGGLE_IR_MODE:
+                LOGE("Select for IR Mode");
+                printf("IR Mode Toggle\n");
+                isirmode = !isirmode;
+                if (isirmode) {
+                    printf("IR Mode On !!!");
+                } else {
+                    printf("IR Mode Off !!!");
+                }
+
+                rc = mm_camera_lib_send_command(&lib_handle,
+                                      MM_CAMERA_LIB_IRMODE,
+                                      &isirmode,
+                                      NULL);
+                if (rc != MM_CAMERA_OK) {
+                    LOGE("mm_camera_lib_send_command() err=%d\n",  rc);
+                    goto ERROR;
+                }
+                break;
+
             case ACTION_SET_ISO:
                 LOGD("Select for ISO changes\n");
                 set_iso(&lib_handle, action_param);