diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp
index 4f60007..117311c 100644
--- a/camera/CameraWrapper.cpp
+++ b/camera/CameraWrapper.cpp
@@ -21,7 +21,7 @@
 *
 */
 
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
 
 #define LOG_TAG "CameraWrapper"
 #include <cutils/log.h>
@@ -46,7 +46,7 @@
         int32_t arg1, int32_t arg2);
 
 static struct hw_module_methods_t camera_module_methods = {
-    .open = camera_device_open,
+    .open = camera_device_open
 };
 
 camera_module_t HAL_MODULE_INFO_SYM = {
@@ -61,7 +61,6 @@
          .dso = NULL, /* remove compilation warnings */
          .reserved = {0}, /* remove compilation warnings */
     },
-
     .get_number_of_cameras = camera_get_number_of_cameras,
     .get_camera_info = camera_get_camera_info,
     .set_callbacks = NULL, /* remove compilation warnings */
@@ -98,16 +97,9 @@
     return rv;
 }
 
-static bool needYUV420preview(android::CameraParameters &params) {
-    int video_width, video_height;
-    params.getPreviewSize(&video_width, &video_height);
-    ALOGV("%s : PreviewSize is %x", __FUNCTION__, video_width*video_height);
-    return video_width*video_height <= 720*720;
-}
-
 #define KEY_VIDEO_HFR_VALUES "video-hfr-values"
 
-const static char * iso_values[] = {"auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800,ISO1600,auto"};
+const static char * iso_values[] = {"auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800"};
 
 static char *camera_fixup_getparams(int id, const char *settings)
 {
@@ -120,11 +112,11 @@
 #endif
 
     // fix params here
-//    params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]);
+    params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]);
     params.set(android::CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5");
-    params.set(android::CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-4");
-    params.set(android::CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "4");
-
+    params.set(android::CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-2");
+    params.set(android::CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "2");
+	
     /* If the vendor has HFR values but doesn't also expose that
      * this can be turned off, fixup the params to tell the Camera
      * that it really is okay to turn it off.
@@ -135,9 +127,9 @@
         sprintf(tmp, "%s,off", hfrValues);
         params.set(KEY_VIDEO_HFR_VALUES, tmp);
     }
-
-    /* Enforce video-snapshot-supported to true */
-    params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true");
+	
+	params.set("whitebalance-values", "auto,incandescent,fluorescent,daylight,cloudy-daylight");
+    params.set("effect-values", "none,mono,negative,sepia");
 
     android::String8 strParams = params.flatten();
     char *ret = strdup(strParams.string());
@@ -161,36 +153,47 @@
     params.dump();
 #endif
 
-    const char *recordingHint = params.get(android::CameraParameters::KEY_RECORDING_HINT);
-    bool isVideo = recordingHint && !strcmp(recordingHint, "true");
-
-    //if (isVideo) {
-        //params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_OFF);
-    //} else {
-        //params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_ON);
-    //}
-
-    if (needYUV420preview(params)) {
-        ALOGV("%s: switching preview format to yuv420p", __FUNCTION__);
+    // No need to fix-up ISO_HJR, it is the same for userspace and the camera lib
+    if (params.get("iso")) {
+        const char *isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
+        if (strcmp(isoMode, "ISO100") == 0)
+            params.set(android::CameraParameters::KEY_ISO_MODE, "100");
+        else if (strcmp(isoMode, "ISO200") == 0)
+            params.set(android::CameraParameters::KEY_ISO_MODE, "200");
+        else if (strcmp(isoMode, "ISO400") == 0)
+            params.set(android::CameraParameters::KEY_ISO_MODE, "400");
+        else if (strcmp(isoMode, "ISO800") == 0)
+            params.set(android::CameraParameters::KEY_ISO_MODE, "800");
+    }
+	
+	// fix params here
+    int video_width, video_height;
+    params.getPreviewSize(&video_width, &video_height);
+    if(video_width*video_height <= 960*540){
         params.set("preview-format", "yuv420p");
     }
+	
+	params.set("scene-detect", "off");
+	
+	bool isVideo = false;
+    if (params.get(android::CameraParameters::KEY_RECORDING_HINT))
+        isVideo = !strcmp(params.get(android::CameraParameters::KEY_RECORDING_HINT), "true");
 
-    // fix params here
-    // No need to fix-up ISO_HJR, it is the same for userspace and the camera lib
-    //if (params.get("iso")) {
-        //const char *isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
-        //if (strcmp(isoMode, "ISO100") == 0)
-            //params.set(android::CameraParameters::KEY_ISO_MODE, "100");
-        //else if (strcmp(isoMode, "ISO200") == 0)
-            //params.set(android::CameraParameters::KEY_ISO_MODE, "200");
-        //else if (strcmp(isoMode, "ISO400") == 0)
-            //params.set(android::CameraParameters::KEY_ISO_MODE, "400");
-        //else if (strcmp(isoMode, "ISO800") == 0)
-            //params.set(android::CameraParameters::KEY_ISO_MODE, "800");
-        //else if (strcmp(isoMode, "ISO1600") == 0)
-            //params.set(android::CameraParameters::KEY_ISO_MODE, "1600");
-    //}
+    if (id == 0) {
+        int camMode;
+        if (params.get(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE)) {
+            camMode = params.getInt(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE);
+        } else {
+            camMode = -1;
+        }
 
+        if (camMode == -1) {
+            params.set(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE, "1");
+        } else {
+            params.set(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE, isVideo ? "1" : "0");
+        }
+    }
+	
     android::String8 strParams = params.flatten();
 
     if (fixed_set_params[id])
@@ -656,4 +659,3 @@
         return 0;
     return gVendorModule->get_camera_info(camera_id, info);
 }
-
