msmcobalt: Update to 07.00.00.253.032

Change-Id: Id896e0b69c3be33768eaf7fc8d4069f2a0ce4ea2
diff --git a/msmcobalt/QCamera2/HAL/QCameraMuxer.cpp b/msmcobalt/QCamera2/HAL/QCameraMuxer.cpp
index bad7393..65c066f 100644
--- a/msmcobalt/QCamera2/HAL/QCameraMuxer.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraMuxer.cpp
@@ -1832,6 +1832,7 @@
             m_pLogicalCamera[index].pId[0] = i;
             m_pLogicalCamera[index].type[0] = CAM_TYPE_MAIN;
             m_pLogicalCamera[index].mode[0] = CAM_MODE_PRIMARY;
+            m_pLogicalCamera[index].sync_3a[0] = CAM_3A_SYNC_FOLLOW;
             m_pLogicalCamera[index].facing = m_pPhyCamera[i].cam_info.facing;
             m_pLogicalCamera[index].numCameras++;
             LOGH("Logical Main Camera ID: %d, facing: %d,"
@@ -1857,6 +1858,7 @@
                     m_pLogicalCamera[j].pId[n] = i;
                     m_pLogicalCamera[j].type[n] = CAM_TYPE_AUX;
                     m_pLogicalCamera[j].mode[n] = CAM_MODE_SECONDARY;
+                    m_pLogicalCamera[j].sync_3a[n] = CAM_3A_SYNC_FOLLOW;
                     m_pLogicalCamera[j].numCameras++;
                     LOGH("Aux %d for Logical Camera ID: %d,"
                         "aux phy id:%d, type: %d mode: %d",
diff --git a/msmcobalt/QCamera2/HAL/QCameraMuxer.h b/msmcobalt/QCamera2/HAL/QCameraMuxer.h
index a85612e..4e9d4c9 100644
--- a/msmcobalt/QCamera2/HAL/QCameraMuxer.h
+++ b/msmcobalt/QCamera2/HAL/QCameraMuxer.h
@@ -88,6 +88,8 @@
     cam_sync_type_t type[MAX_NUM_CAMERA_PER_BUNDLE];
     // Signifies mode of each camera
     cam_sync_mode_t mode[MAX_NUM_CAMERA_PER_BUNDLE];
+    // Signifies mode of each 3a used by the camera
+    cam_3a_sync_mode_t sync_3a[MAX_NUM_CAMERA_PER_BUNDLE];
 } qcamera_logical_descriptor_t;
 
 /* Struct@ cam_compose_jpeg_info_t
diff --git a/msmcobalt/QCamera2/HAL/QCameraParameters.cpp b/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
index 6472e7d..b506e76 100755
--- a/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
+++ b/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
@@ -13875,7 +13875,7 @@
         return;
     }
 
-    if ((getZoomLevel() != 0)
+    if ((getZoomLevel() != 0 && !getQuadraCfa())
             && (getBurstCountForAdvancedCapture()
             == getNumOfSnapshots())) {
         LOGD("2 Pass postprocessing enabled");
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp b/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp
old mode 100755
new mode 100644
index ff08c92..13c265d
--- a/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/msmcobalt/QCamera2/HAL3/QCamera3HWI.cpp
@@ -1225,8 +1225,15 @@
     int property_len;
 
     /* Get feature mask from property */
+#ifdef _LE_CAMERA_
+    char swtnr_feature_mask_value[PROPERTY_VALUE_MAX];
+    snprintf(swtnr_feature_mask_value, PROPERTY_VALUE_MAX, "%lld", CAM_QTI_FEATURE_SW_TNR);
+    property_len = property_get("persist.camera.hal3.feature",
+            feature_mask_value, swtnr_feature_mask_value);
+#else
     property_len = property_get("persist.camera.hal3.feature",
             feature_mask_value, "0");
+#endif
     if ((property_len > 2) && (feature_mask_value[0] == '0') &&
             (feature_mask_value[1] == 'x')) {
         args_converted = sscanf(feature_mask_value, "0x%llx", &feature_mask);
@@ -3813,11 +3820,13 @@
             if (mIsMainCamera == 1) {
                 m_pRelCamSyncBuf->mode = CAM_MODE_PRIMARY;
                 m_pRelCamSyncBuf->type = CAM_TYPE_MAIN;
+                m_pRelCamSyncBuf->sync_3a_mode = CAM_3A_SYNC_FOLLOW;
                 // related session id should be session id of linked session
                 m_pRelCamSyncBuf->related_sensor_session_id = sessionId[mLinkedCameraId];
             } else {
                 m_pRelCamSyncBuf->mode = CAM_MODE_SECONDARY;
                 m_pRelCamSyncBuf->type = CAM_TYPE_AUX;
+                m_pRelCamSyncBuf->sync_3a_mode = CAM_3A_SYNC_FOLLOW;
                 m_pRelCamSyncBuf->related_sensor_session_id = sessionId[mLinkedCameraId];
             }
             pthread_mutex_unlock(&gCamLock);
@@ -4394,11 +4403,13 @@
         if (mIsMainCamera == 1) {
             m_pRelCamSyncBuf->mode = CAM_MODE_PRIMARY;
             m_pRelCamSyncBuf->type = CAM_TYPE_MAIN;
+            m_pRelCamSyncBuf->sync_3a_mode = CAM_3A_SYNC_FOLLOW;
             // related session id should be session id of linked session
             m_pRelCamSyncBuf->related_sensor_session_id = sessionId[mLinkedCameraId];
         } else {
             m_pRelCamSyncBuf->mode = CAM_MODE_SECONDARY;
             m_pRelCamSyncBuf->type = CAM_TYPE_AUX;
+            m_pRelCamSyncBuf->sync_3a_mode = CAM_3A_SYNC_FOLLOW;
             m_pRelCamSyncBuf->related_sensor_session_id = sessionId[mLinkedCameraId];
         }
         pthread_mutex_unlock(&gCamLock);
@@ -5573,6 +5584,16 @@
         camMetadata.update(QCAMERA3_IR_MODE,(int32_t *) &ir, 1);
     }
 
+    // AEC SPEED
+    IF_META_AVAILABLE(float, aec, CAM_INTF_META_AEC_CONVERGENCE_SPEED, metadata) {
+        camMetadata.update(QCAMERA3_AEC_CONVERGENCE_SPEED, aec, 1);
+    }
+
+    // AWB SPEED
+    IF_META_AVAILABLE(float, awb, CAM_INTF_META_AWB_CONVERGENCE_SPEED, metadata) {
+        camMetadata.update(QCAMERA3_AWB_CONVERGENCE_SPEED, awb, 1);
+    }
+
     // TNR
     IF_META_AVAILABLE(cam_denoise_param_t, tnr, CAM_INTF_PARM_TEMPORAL_DENOISE, metadata) {
         uint8_t tnr_enable       = tnr->denoise_enable;
@@ -8563,6 +8584,14 @@
     int32_t ir_mode = (int32_t)QCAMERA3_IR_MODE_OFF;
     settings.update(QCAMERA3_IR_MODE, &ir_mode, 1);
 
+    /* Manual Convergence AEC Speed is disabled by default*/
+    float default_aec_speed = 0;
+    settings.update(QCAMERA3_AEC_CONVERGENCE_SPEED, &default_aec_speed, 1);
+
+    /* Manual Convergence AWB Speed is disabled by default*/
+    float default_awb_speed = 0;
+    settings.update(QCAMERA3_AWB_CONVERGENCE_SPEED, &default_awb_speed, 1);
+
     mDefaultMetadata[type] = settings.release();
 
     return mDefaultMetadata[type];
@@ -9683,6 +9712,34 @@
         }
     }
 
+    if (frame_settings.exists(QCAMERA3_AEC_CONVERGENCE_SPEED)) {
+        float aec_speed;
+        aec_speed = frame_settings.find(QCAMERA3_AEC_CONVERGENCE_SPEED).data.f[0];
+        LOGD("AEC Speed :%f", aec_speed);
+        if ( aec_speed < 0 ) {
+            LOGE("Invalid AEC mode %f!", aec_speed);
+        } else {
+            if (ADD_SET_PARAM_ENTRY_TO_BATCH(hal_metadata, CAM_INTF_META_AEC_CONVERGENCE_SPEED,
+                    aec_speed)) {
+                rc = BAD_VALUE;
+            }
+        }
+    }
+
+    if (frame_settings.exists(QCAMERA3_AWB_CONVERGENCE_SPEED)) {
+        float awb_speed;
+        awb_speed = frame_settings.find(QCAMERA3_AWB_CONVERGENCE_SPEED).data.f[0];
+        LOGD("AWB Speed :%f", awb_speed);
+        if ( awb_speed < 0 ) {
+            LOGE("Invalid AWB mode %f!", awb_speed);
+        } else {
+            if (ADD_SET_PARAM_ENTRY_TO_BATCH(hal_metadata, CAM_INTF_META_AWB_CONVERGENCE_SPEED,
+                    awb_speed)) {
+                rc = BAD_VALUE;
+            }
+        }
+    }
+
     // TNR
     if (frame_settings.exists(QCAMERA3_TEMPORAL_DENOISE_ENABLE) &&
         frame_settings.exists(QCAMERA3_TEMPORAL_DENOISE_PROCESS_TYPE)) {
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp
old mode 100755
new mode 100644
index 7ad77b2..d8693ea
--- a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp
+++ b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.cpp
@@ -56,8 +56,10 @@
         QCAMERA3_HAL_PRIVATEDATA_END,
         QCAMERA3_JPEG_ENCODE_CROP_END,
         QCAMERA3_VIDEO_HDR_END,
-        QCAMERA3_IR_END
-};
+        QCAMERA3_IR_END,
+        QCAMERA3_AEC_CONVERGENCE_SPEED_END,
+        QCAMERA3_AWB_CONVERGENCE_SPEED_END
+} ;
 
 typedef struct vendor_tag_info {
     const char *tag_name;
@@ -79,7 +81,9 @@
     "org.codeaurora.qcamera3.hal_private_data",
     "org.codeaurora.qcamera3.jpeg_encode_crop",
     "org.codeaurora.qcamera3.video_hdr_mode",
-    "org.codeaurora.qcamera3.ir"
+    "org.codeaurora.qcamera3.ir",
+    "org.codeaurora.qcamera3.aec_convergence_speed",
+    "org.codeaurora.qcamera3.awb_convergence_speed"
 };
 
 vendor_tag_info_t qcamera3_privatedata[QCAMERA3_PRIVATEDATA_END - QCAMERA3_PRIVATEDATA_START] = {
@@ -166,6 +170,16 @@
     { "ir_supported_modes", TYPE_INT32}
 };
 
+vendor_tag_info_t qcamera3_aec_speed[QCAMERA3_AEC_CONVERGENCE_SPEED_END -
+        QCAMERA3_AEC_CONVERGENCE_SPEED_START] = {
+    {"aec_speed", TYPE_FLOAT }
+};
+
+vendor_tag_info_t qcamera3_awb_speed[QCAMERA3_AWB_CONVERGENCE_SPEED_END -
+        QCAMERA3_AWB_CONVERGENCE_SPEED_START] = {
+    {"awb_speed", TYPE_FLOAT }
+};
+
 vendor_tag_info_t *qcamera3_tag_info[QCAMERA3_SECTIONS_END -
         VENDOR_SECTION] = {
     qcamera3_privatedata,
@@ -181,7 +195,9 @@
     qcamera3_hal_privatedata,
     qcamera3_jpep_encode_crop,
     qcamera3_video_hdr,
-    qcamera3_ir
+    qcamera3_ir,
+    qcamera3_aec_speed,
+    qcamera3_awb_speed
 };
 
 uint32_t qcamera3_all_tags[] = {
@@ -237,7 +253,13 @@
 
     // QCAMERA3_IR_MODE_ENABLE
     (uint32_t)QCAMERA3_IR_MODE,
-    (uint32_t)QCAMERA3_IR_AVAILABLE_MODES
+    (uint32_t)QCAMERA3_IR_AVAILABLE_MODES,
+
+    //QCAMERA3_AEC_CONVERGENCE_SPEED
+    (uint32_t)QCAMERA3_AEC_CONVERGENCE_SPEED,
+
+    //QCAMERA3_AWB_CONVERGENCE_SPEED
+    (uint32_t)QCAMERA3_AWB_CONVERGENCE_SPEED
 };
 
 const vendor_tag_ops_t* QCamera3VendorTags::Ops = NULL;
diff --git a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h
old mode 100755
new mode 100644
index 31fafd9..224a7be
--- a/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h
+++ b/msmcobalt/QCamera2/HAL3/QCamera3VendorTags.h
@@ -50,6 +50,8 @@
     QCAMERA3_JPEG_ENCODE_CROP,
     QCAMERA3_VIDEO_HDR,
     QCAMERA3_IR,
+    QCAMERA3_AEC_CONVERGENCE,
+    QCAMERA3_AWB_CONVERGENCE,
     QCAMERA3_SECTIONS_END
 };
 
@@ -67,7 +69,9 @@
     QCAMERA3_HAL_PRIVATEDATA_START = QCAMERA3_HAL_PRIVATEDATA << 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
+    QCAMERA3_IR_START = QCAMERA3_IR << 16,
+    QCAMERA3_AEC_CONVERGENCE_SPEED_START = QCAMERA3_AEC_CONVERGENCE << 16,
+    QCAMERA3_AWB_CONVERGENCE_SPEED_START = QCAMERA3_AWB_CONVERGENCE << 16
 };
 
 enum qcamera3_ext_tags {
@@ -193,7 +197,13 @@
 
     QCAMERA3_IR_MODE = QCAMERA3_IR_START,
     QCAMERA3_IR_AVAILABLE_MODES,
-    QCAMERA3_IR_END
+    QCAMERA3_IR_END,
+
+    QCAMERA3_AEC_CONVERGENCE_SPEED = QCAMERA3_AEC_CONVERGENCE_SPEED_START,
+    QCAMERA3_AEC_CONVERGENCE_SPEED_END,
+
+    QCAMERA3_AWB_CONVERGENCE_SPEED = QCAMERA3_AWB_CONVERGENCE_SPEED_START,
+    QCAMERA3_AWB_CONVERGENCE_SPEED_END
 };
 
 // QCAMERA3_OPAQUE_RAW_FORMAT
diff --git a/msmcobalt/QCamera2/stack/common/cam_intf.h b/msmcobalt/QCamera2/stack/common/cam_intf.h
index 941d59c..8b6fecb 100755
--- a/msmcobalt/QCamera2/stack/common/cam_intf.h
+++ b/msmcobalt/QCamera2/stack/common/cam_intf.h
@@ -86,6 +86,7 @@
     cam_sync_related_sensors_control_t sync_control;
     cam_sync_type_t type;
     cam_sync_mode_t mode;
+    cam_3a_sync_mode_t sync_3a_mode;
     /* session Id of the other camera session
        Linking will be done with this session in the
        backend */
@@ -827,6 +828,7 @@
     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  1);
     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint32_t,                    1);
+    INCLUDE(CAM_INTF_META_AWB_CONVERGENCE_SPEED,        float,                       1);
     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint32_t,                    1);
     INCLUDE(CAM_INTF_META_MODE,                         uint32_t,                    1);
     INCLUDE(CAM_INTF_META_EDGE_MODE,                    cam_edge_application_t,      1);
@@ -839,6 +841,8 @@
     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
+    INCLUDE(CAM_INTF_META_FOCUS_VALUE,                  float,                       1);
+    INCLUDE(CAM_INTF_META_SPOT_LIGHT_DETECT,            uint8_t,                     1);
     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
     INCLUDE(CAM_INTF_META_LENS_STATE,                   cam_af_lens_state_t,         1);
     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint32_t,                    1);
@@ -962,6 +966,7 @@
     /* HAL3 specific */
     INCLUDE(CAM_INTF_META_STREAM_INFO,                  cam_stream_size_info_t,      1);
     INCLUDE(CAM_INTF_META_AEC_MODE,                     uint32_t,                    1);
+    INCLUDE(CAM_INTF_META_AEC_CONVERGENCE_SPEED,        float,                       1);
     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,       cam_trigger_t,               1);
     INCLUDE(CAM_INTF_META_AF_TRIGGER,                   cam_trigger_t,               1);
     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,               uint32_t,                    1);
diff --git a/msmcobalt/QCamera2/stack/common/cam_types.h b/msmcobalt/QCamera2/stack/common/cam_types.h
old mode 100755
new mode 100644
index 559796a..18acfe6
--- a/msmcobalt/QCamera2/stack/common/cam_types.h
+++ b/msmcobalt/QCamera2/stack/common/cam_types.h
@@ -1389,6 +1389,8 @@
     int32_t focus_pos;
     cam_af_flush_info_t flush_info;
     uint8_t isDepth;
+    float focus_value;
+    uint8_t spot_light_detected;
 } cam_auto_focus_data_t;
 
 typedef struct {
@@ -1656,6 +1658,12 @@
     CAM_TYPE_AUX
 } cam_sync_type_t;
 
+typedef enum {
+    CAM_3A_SYNC_NONE,     /* Default for single camera, not link */
+    CAM_3A_SYNC_FOLLOW,   /* Master->Slave: Master updates slave */
+    CAM_3A_SYNC_ALGO_CTRL,/* Algorithm updated cameras directly */
+} cam_3a_sync_mode_t;
+
 typedef struct {
     cam_dimension_t stream_sizes[MAX_NUM_STREAMS];
     uint32_t num_streams;
@@ -2228,6 +2236,13 @@
     CAM_INTF_META_FOCUS_DEPTH_INFO,
     /* Operation Mode for IR */
     CAM_INTF_META_IR_MODE,
+    /* AEC,AWB Speed control enabled */
+    CAM_INTF_META_AEC_CONVERGENCE_SPEED,
+    CAM_INTF_META_AWB_CONVERGENCE_SPEED,
+    /*Focus value output from af core*/
+    CAM_INTF_META_FOCUS_VALUE,
+    /*Spot light detection result output from af core*/
+    CAM_INTF_META_SPOT_LIGHT_DETECT,
     CAM_INTF_PARM_MAX
 } cam_intf_parm_type_t;
 
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 1b206e4..1851b28 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
@@ -268,6 +268,7 @@
 typedef struct {
     uint32_t width;
     uint32_t height;
+    int isZSL;
 } mm_camera_lib_snapshot_params;
 
 typedef enum {
@@ -442,7 +443,7 @@
                                                mm_camera_buf_notify_t stream_cb,
                                                void *userdata,
                                                uint8_t num_bufs);
-extern int mm_app_start_record_preview(mm_camera_test_obj_t *test_obj);
+extern int mm_app_start_record_preview(mm_camera_test_obj_t *test_obj, mm_camera_lib_snapshot_params *dim);
 extern int mm_app_stop_record_preview(mm_camera_test_obj_t *test_obj);
 extern int mm_app_start_record(mm_camera_test_obj_t *test_obj);
 extern int mm_app_stop_record(mm_camera_test_obj_t *test_obj);
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 482dfb9..8ddad3e 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
@@ -2095,8 +2095,8 @@
             break;
         case MM_CAMERA_LIB_ZSL_ENABLE:
             if ( NULL != in_data) {
-                int enable_zsl = *(( int * )in_data);
-                if ( ( enable_zsl != handle->test_obj.zsl_enabled ) &&
+                dim = ( mm_camera_lib_snapshot_params * ) in_data;
+                if ( ( dim->isZSL!= handle->test_obj.zsl_enabled ) &&
                         handle->stream_running ) {
                     rc = mm_camera_lib_stop_stream(handle);
                     if (rc != MM_CAMERA_OK) {
@@ -2104,7 +2104,10 @@
                                     rc);
                         goto EXIT;
                     }
-                    handle->test_obj.zsl_enabled = enable_zsl;
+                    handle->test_obj.zsl_enabled   = dim->isZSL;
+                    handle->test_obj.buffer_width  = dim->width;
+                    handle->test_obj.buffer_height = dim->height;
+
                     rc = mm_camera_lib_start_stream(handle);
                     if (rc != MM_CAMERA_OK) {
                         LOGE("mm_camera_lib_start_stream() err=%d\n",
@@ -2112,7 +2115,7 @@
                         goto EXIT;
                     }
                 } else {
-                    handle->test_obj.zsl_enabled = enable_zsl;
+                    handle->test_obj.zsl_enabled = dim->isZSL;
                 }
             }
             break;
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 6e78467..56c0437 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
@@ -1653,6 +1653,7 @@
 
     mm_camera_test_obj_t test_obj;
     memset(&test_obj, 0, sizeof(mm_camera_test_obj_t));
+    memset(&snap_dim, 0, sizeof(mm_camera_lib_snapshot_params));
 
     rc = mm_camera_lib_open(&lib_handle, 0);
     if (rc != MM_CAMERA_OK) {
@@ -1930,9 +1931,10 @@
                 } else {
                     printf("ZSL off !!!\n");
                 }
+                snap_dim.isZSL = isZSL;
                 rc = mm_camera_lib_send_command(&lib_handle,
                                                 MM_CAMERA_LIB_ZSL_ENABLE,
-                                                &isZSL,
+                                                &snap_dim,
                                                 NULL);
                 if (rc != MM_CAMERA_OK) {
                     LOGE("mm_camera_lib_send_command() err=%d\n",  rc);
@@ -1985,7 +1987,7 @@
 
            case ACTION_START_RECORDING:
              LOGD("Start recording action\n");
-             mm_app_start_record_preview(&lib_handle.test_obj);
+             mm_app_start_record_preview(&lib_handle.test_obj, &snap_dim);
              is_rec = 1;
              break;
 
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_preview.c b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_preview.c
index 46596bc..4f27719 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_preview.c
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_preview.c
@@ -920,8 +920,13 @@
     abc_snap.type[1] = CAM_STREAM_TYPE_PREVIEW;
 
     abc_snap.postprocess_mask[0] = 0;
-    abc_snap.stream_sizes[0].width = DEFAULT_SNAPSHOT_WIDTH;
-    abc_snap.stream_sizes[0].height = DEFAULT_SNAPSHOT_HEIGHT;
+    if ( test_obj->buffer_width == 0 || test_obj->buffer_height == 0 ) {
+        abc_snap.stream_sizes[0].width = DEFAULT_SNAPSHOT_WIDTH;
+        abc_snap.stream_sizes[0].height = DEFAULT_SNAPSHOT_HEIGHT;
+    } else {
+        abc_snap.stream_sizes[0].width = test_obj->buffer_width;
+        abc_snap.stream_sizes[0].height = test_obj->buffer_height;
+    }
     abc_snap.type[0] = CAM_STREAM_TYPE_SNAPSHOT;
 
     abc_snap.buffer_info.min_buffers = 7;
@@ -964,8 +969,8 @@
         stream->s_config.stream_info->dim.width = DEFAULT_SNAPSHOT_WIDTH;
         stream->s_config.stream_info->dim.height = DEFAULT_SNAPSHOT_HEIGHT;
     } else {
-        stream->s_config.stream_info->dim.width = DEFAULT_SNAPSHOT_WIDTH;
-        stream->s_config.stream_info->dim.height = DEFAULT_SNAPSHOT_HEIGHT;
+        stream->s_config.stream_info->dim.width = test_obj->buffer_width;
+        stream->s_config.stream_info->dim.height = test_obj->buffer_height;
     }
     stream->s_config.padding_info = cam_cap->padding_info;
     /* Make offset as zero as CPP will not be used  */
@@ -997,13 +1002,18 @@
 
     abc_snap.num_streams = 2;
     abc_snap.postprocess_mask[1] = 2178;
-    abc_snap.stream_sizes[1].width = DEFAULT_PREVIEW_WIDTH;
+    abc_snap.stream_sizes[1].width  = DEFAULT_PREVIEW_WIDTH;
     abc_snap.stream_sizes[1].height = DEFAULT_PREVIEW_HEIGHT;
     abc_snap.type[1] = CAM_STREAM_TYPE_POSTVIEW;
 
     abc_snap.postprocess_mask[0] = 0;
-    abc_snap.stream_sizes[0].width = DEFAULT_SNAPSHOT_WIDTH;
-    abc_snap.stream_sizes[0].height = DEFAULT_SNAPSHOT_HEIGHT;
+    if ( test_obj->buffer_width == 0 || test_obj->buffer_height == 0 ) {
+        abc_snap.stream_sizes[0].width  = DEFAULT_SNAPSHOT_WIDTH;
+        abc_snap.stream_sizes[0].height = DEFAULT_SNAPSHOT_HEIGHT;
+    } else {
+        abc_snap.stream_sizes[0].width  = test_obj->buffer_width;
+        abc_snap.stream_sizes[0].height = test_obj->buffer_height;
+    }
     abc_snap.type[0] = CAM_STREAM_TYPE_SNAPSHOT;
 
     abc_snap.buffer_info.min_buffers = 7;
@@ -1046,8 +1056,8 @@
         stream->s_config.stream_info->dim.width = DEFAULT_SNAPSHOT_WIDTH;
         stream->s_config.stream_info->dim.height = DEFAULT_SNAPSHOT_HEIGHT;
     } else {
-        stream->s_config.stream_info->dim.width = DEFAULT_SNAPSHOT_WIDTH;
-        stream->s_config.stream_info->dim.height = DEFAULT_SNAPSHOT_HEIGHT;
+        stream->s_config.stream_info->dim.width = test_obj->buffer_width;
+        stream->s_config.stream_info->dim.height = test_obj->buffer_height;
     }
     stream->s_config.padding_info = cam_cap->padding_info;
     /* Make offset as zero as CPP will not be used  */
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_unit_test.c b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_unit_test.c
index c6eaab7..78fd424 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_unit_test.c
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_unit_test.c
@@ -171,6 +171,8 @@
     int rc = MM_CAMERA_OK;
     int i, j;
     mm_camera_test_obj_t test_obj;
+    mm_camera_lib_snapshot_params dim;
+    memset(&dim, 0, sizeof(mm_camera_lib_snapshot_params));
 
     printf("\n Verifying start/stop video preview...\n");
     for (i = 0; i < cam_app->num_cameras; i++) {
@@ -183,7 +185,7 @@
         }
 
         for (j = 0; j < MM_QCAMERA_APP_UTEST_INNER_LOOP; j++) {
-            rc = mm_app_start_record_preview(&test_obj);
+            rc = mm_app_start_record_preview(&test_obj, &dim);
             if (rc != MM_CAMERA_OK) {
                 LOGE("mm_app_start_record_preview() cam_idx=%d, err=%d\n",
                             i, rc);
@@ -219,6 +221,8 @@
     int rc = MM_CAMERA_OK;
     int i, j;
     mm_camera_test_obj_t test_obj;
+    mm_camera_lib_snapshot_params dim;
+    memset(&dim, 0, sizeof(mm_camera_lib_snapshot_params));
 
     printf("\n Verifying start/stop recording...\n");
     for (i = 0; i < cam_app->num_cameras; i++) {
@@ -230,7 +234,7 @@
             break;
         }
 
-        rc = mm_app_start_record_preview(&test_obj);
+        rc = mm_app_start_record_preview(&test_obj, &dim);
         if (rc != MM_CAMERA_OK) {
             LOGE("mm_app_start_record_preview() cam_idx=%d, err=%d\n",
                         i, rc);
@@ -294,6 +298,8 @@
     int rc = MM_CAMERA_OK;
     int i, j;
     mm_camera_test_obj_t test_obj;
+    mm_camera_lib_snapshot_params dim;
+    memset(&dim, 0, sizeof(mm_camera_lib_snapshot_params));
 
     printf("\n Verifying start/stop live snapshot...\n");
     for (i = 0; i < cam_app->num_cameras; i++) {
@@ -305,7 +311,7 @@
             break;
         }
 
-        rc = mm_app_start_record_preview(&test_obj);
+        rc = mm_app_start_record_preview(&test_obj, &dim);
         if (rc != MM_CAMERA_OK) {
             LOGE("mm_app_start_record_preview() cam_idx=%d, err=%d\n",
                         i, rc);
diff --git a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_video.c b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_video.c
index bf07877..1792c27 100644
--- a/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_video.c
+++ b/msmcobalt/QCamera2/stack/mm-camera-test/src/mm_qcamera_video.c
@@ -432,8 +432,8 @@
         stream->s_config.stream_info->dim.width = DEFAULT_SNAPSHOT_WIDTH;
         stream->s_config.stream_info->dim.height = DEFAULT_SNAPSHOT_HEIGHT;
     } else {
-        stream->s_config.stream_info->dim.width = DEFAULT_SNAPSHOT_WIDTH;
-        stream->s_config.stream_info->dim.height = DEFAULT_SNAPSHOT_HEIGHT;
+        stream->s_config.stream_info->dim.width = test_obj->buffer_width;
+        stream->s_config.stream_info->dim.height = test_obj->buffer_height;
     }
     stream->s_config.padding_info = cam_cap->padding_info;
     /* Make offset as zero as CPP will not be used  */
@@ -476,8 +476,13 @@
     abc_snap.type[1] = CAM_STREAM_TYPE_VIDEO;
 
     abc_snap.postprocess_mask[0] = 0;
-    abc_snap.stream_sizes[0].width = DEFAULT_SNAPSHOT_WIDTH;
-    abc_snap.stream_sizes[0].height = DEFAULT_SNAPSHOT_HEIGHT;
+	if ( test_obj->buffer_width == 0 || test_obj->buffer_height == 0 ) {
+        abc_snap.stream_sizes[0].width = DEFAULT_SNAPSHOT_WIDTH;
+        abc_snap.stream_sizes[0].height = DEFAULT_SNAPSHOT_HEIGHT;
+	} else {
+        abc_snap.stream_sizes[0].width = test_obj->buffer_width;
+        abc_snap.stream_sizes[0].height = test_obj->buffer_height;
+	}
     abc_snap.type[0] = CAM_STREAM_TYPE_SNAPSHOT;
 
     abc_snap.buffer_info.min_buffers = 7;
@@ -553,7 +558,8 @@
     return channel;
 }
 
-int mm_app_start_record_preview(mm_camera_test_obj_t *test_obj)
+int mm_app_start_record_preview(mm_camera_test_obj_t *test_obj,
+	mm_camera_lib_snapshot_params *dim)
 {
     int rc = MM_CAMERA_OK;
     mm_camera_channel_t *p_ch = NULL;
@@ -565,6 +571,10 @@
     mm_camera_stream_t *s_video = NULL;
 
 
+	if (dim != NULL) {
+        test_obj->buffer_width  = dim->width;
+        test_obj->buffer_height = dim->height;
+	}
     /* Create Video Channel */
     v_ch = mm_app_add_channel(test_obj,
                               MM_CHANNEL_TYPE_VIDEO,