QCamera2/HAL3: Disable CDS for HFR

CDS is not verified by ISP team for batch mode. We see camera
preview freezes in HFR mode while mode switching if CDS is enabled.
This change sets the CDS to OFF on the first process capture request
in HFR mode and also blocks the CDS per-frame setting

Change-Id: I1588cd244000afd2949e7a79ba09a2e5f7c4a341
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index 6cadb0d..817e293 100755
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -2823,7 +2823,17 @@
         int32_t tintless_value = 1;
         ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters,
                 CAM_INTF_PARM_TINTLESS, tintless_value);
+        //Disable CDS for HFR mode and if mPprocBypass = true.
+        //CDS is a session parameter in the backend/ISP, so need to be set/reset
+        //after every configure_stream
+        if((CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE == mOpMode) ||
+                mPprocBypass) {
+            int32_t cds = CAM_CDS_MODE_OFF;
+            if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters,
+                    CAM_INTF_PARM_CDS_MODE, cds))
+                ALOGE("%s: Failed to disable CDS for HFR mode", __func__);
 
+        }
         setMobicat();
 
         /* Set fps and hfr mode while sending meta stream info so that sensor
@@ -7662,15 +7672,16 @@
         }
     }
 
-    // CDS
-    if (frame_settings.exists(QCAMERA3_CDS_MODE)) {
+    // CDS for non-HFR mode
+    if ((mOpMode != CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE) &&
+            (false == mPprocBypass) &&
+            frame_settings.exists(QCAMERA3_CDS_MODE)) {
         int32_t *fwk_cds = frame_settings.find(QCAMERA3_CDS_MODE).data.i32;
-        int32_t overridden_cds = (mPprocBypass ? CAM_CDS_MODE_OFF : *fwk_cds);
-        if ((CAM_CDS_MODE_MAX <= overridden_cds) || (0 > overridden_cds)) {
-            ALOGE("%s: Invalid CDS mode %d!", __func__, overridden_cds);
+        if ((CAM_CDS_MODE_MAX <= *fwk_cds) || (0 > *fwk_cds)) {
+            ALOGE("%s: Invalid CDS mode %d!", __func__, *fwk_cds);
         } else {
             if (ADD_SET_PARAM_ENTRY_TO_BATCH(hal_metadata,
-                    CAM_INTF_PARM_CDS_MODE, overridden_cds)) {
+                    CAM_INTF_PARM_CDS_MODE, *fwk_cds)) {
                 rc = BAD_VALUE;
             }
         }