Program: 38226
Project: 38226
Buggy source:
/** 
 * This can run on a background thread, so don't do UI updates here.
 */
private void qcomUpdateCameraParametersPreference(){
  mParameters.set("String_Node_Str",String.valueOf(mbrightness));
  String longshot_enable=mPreferences.getString(CameraSettings.KEY_LONGSHOT,mActivity.getString(R.string.pref_camera_longshot_default));
  mParameters.set("String_Node_Str",longshot_enable);
  String optizoomOn=mActivity.getString(R.string.pref_camera_advanced_feature_value_optizoom_on);
  if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode) || CameraUtil.SCENE_MODE_HDR.equals(mSceneMode) || optizoomOn.equals(mSceneMode)) {
    String touchAfAec=mPreferences.getString(CameraSettings.KEY_TOUCH_AF_AEC,mActivity.getString(R.string.pref_camera_touchafaec_default));
    if (CameraUtil.isSupported(touchAfAec,mParameters.getSupportedTouchAfAec())) {
      mCurrTouchAfAec=touchAfAec;
      mParameters.setTouchAfAec(touchAfAec);
    }
  }
 else {
    mParameters.setTouchAfAec(mParameters.TOUCH_AF_AEC_OFF);
    mFocusManager.resetTouchFocus();
  }
  try {
    if (mParameters.getTouchAfAec().equals(mParameters.TOUCH_AF_AEC_ON))     this.mTouchAfAecFlag=true;
 else     this.mTouchAfAecFlag=false;
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str");
  }
  String pictureFormat=mPreferences.getString(CameraSettings.KEY_PICTURE_FORMAT,mActivity.getString(R.string.pref_camera_picture_format_default));
  if (mIsImageCaptureIntent && !pictureFormat.equals(PIXEL_FORMAT_JPEG)) {
    pictureFormat=PIXEL_FORMAT_JPEG;
    Editor editor=mPreferences.edit();
    editor.putString(CameraSettings.KEY_PICTURE_FORMAT,mActivity.getString(R.string.pref_camera_picture_format_value_jpeg));
    editor.apply();
  }
  Log.v(TAG,"String_Node_Str" + pictureFormat);
  mParameters.set(KEY_PICTURE_FORMAT,pictureFormat);
  String jpegQuality=mPreferences.getString(CameraSettings.KEY_JPEG_QUALITY,mActivity.getString(R.string.pref_camera_jpegquality_default));
  Size pic_size=mParameters.getPictureSize();
  if (pic_size == null) {
    Log.e(TAG,"String_Node_Str");
  }
 else {
    if ("String_Node_Str".equals(jpegQuality) && (pic_size.width >= 3200)) {
    }
 else {
      mParameters.setJpegQuality(JpegEncodingQualityMappings.getQualityNumber(jpegQuality));
      int jpegFileSize=estimateJpegFileSize(pic_size,jpegQuality);
      if (jpegFileSize != mJpegFileSizeEstimation) {
        mJpegFileSizeEstimation=jpegFileSize;
        mHandler.post(new Runnable(){
          @Override public void run(){
            updateRemainingPhotos();
          }
        }
);
      }
    }
  }
  String selectableZoneAf=mPreferences.getString(CameraSettings.KEY_SELECTABLE_ZONE_AF,mActivity.getString(R.string.pref_camera_selectablezoneaf_default));
  List<String> str=mParameters.getSupportedSelectableZoneAf();
  if (CameraUtil.isSupported(selectableZoneAf,mParameters.getSupportedSelectableZoneAf())) {
    mParameters.setSelectableZoneAf(selectableZoneAf);
  }
  if (mParameters.getSupportedDenoiseModes() != null) {
    String Denoise=mPreferences.getString(CameraSettings.KEY_DENOISE,mActivity.getString(R.string.pref_camera_denoise_default));
    mParameters.setDenoise(Denoise);
  }
  String redeyeReduction=mPreferences.getString(CameraSettings.KEY_REDEYE_REDUCTION,mActivity.getString(R.string.pref_camera_redeyereduction_default));
  if (CameraUtil.isSupported(redeyeReduction,mParameters.getSupportedRedeyeReductionModes())) {
    mParameters.setRedeyeReductionMode(redeyeReduction);
  }
  if ((mManual3AEnabled & MANUAL_EXPOSURE) == 0) {
    String iso=mPreferences.getString(CameraSettings.KEY_ISO,mActivity.getString(R.string.pref_camera_iso_default));
    if (CameraUtil.isSupported(iso,mParameters.getSupportedIsoValues())) {
      mParameters.setISOValue(iso);
    }
  }
  String colorEffect=mPreferences.getString(CameraSettings.KEY_COLOR_EFFECT,mActivity.getString(R.string.pref_camera_coloreffect_default));
  Log.v(TAG,"String_Node_Str" + colorEffect);
  if (CameraUtil.isSupported(colorEffect,mParameters.getSupportedColorEffects())) {
    mParameters.setColorEffect(colorEffect);
  }
  String saturationStr=mPreferences.getString(CameraSettings.KEY_SATURATION,mActivity.getString(R.string.pref_camera_saturation_default));
  int saturation=Integer.parseInt(saturationStr);
  Log.v(TAG,"String_Node_Str" + saturation);
  if ((0 <= saturation) && (saturation <= mParameters.getMaxSaturation())) {
    mParameters.setSaturation(saturation);
  }
  String contrastStr=mPreferences.getString(CameraSettings.KEY_CONTRAST,mActivity.getString(R.string.pref_camera_contrast_default));
  int contrast=Integer.parseInt(contrastStr);
  Log.v(TAG,"String_Node_Str" + contrast);
  if ((0 <= contrast) && (contrast <= mParameters.getMaxContrast())) {
    mParameters.setContrast(contrast);
  }
  String sharpnessStr=mPreferences.getString(CameraSettings.KEY_SHARPNESS,mActivity.getString(R.string.pref_camera_sharpness_default));
  int sharpness=Integer.parseInt(sharpnessStr) * (mParameters.getMaxSharpness() / MAX_SHARPNESS_LEVEL);
  Log.v(TAG,"String_Node_Str" + sharpness);
  if ((0 <= sharpness) && (sharpness <= mParameters.getMaxSharpness())) {
    mParameters.setSharpness(sharpness);
  }
  String faceRC=mPreferences.getString(CameraSettings.KEY_FACE_RECOGNITION,mActivity.getString(R.string.pref_camera_facerc_default));
  Log.v(TAG,"String_Node_Str" + faceRC);
  if (CameraUtil.isSupported(faceRC,CameraSettings.getSupportedFaceRecognitionModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_QC_FACE_RECOGNITION,faceRC);
  }
  String aeBracketing=mPreferences.getString(CameraSettings.KEY_AE_BRACKET_HDR,mActivity.getString(R.string.pref_camera_ae_bracket_hdr_default));
  Log.v(TAG,"String_Node_Str" + aeBracketing);
  if (CameraUtil.isSupported(aeBracketing,CameraSettings.getSupportedAEBracketingModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_QC_AE_BRACKETING,aeBracketing);
  }
  String cds=mPreferences.getString(CameraSettings.KEY_CDS_MODE,mActivity.getString(R.string.pref_camera_cds_default));
  if ((mPrevSavedCDS == null) && (cds != null)) {
    mPrevSavedCDS=cds;
  }
  if (CameraUtil.isSupported(cds,CameraSettings.getSupportedCDSModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_QC_CDS_MODE,cds);
  }
  String tnr=mPreferences.getString(CameraSettings.KEY_TNR_MODE,mActivity.getString(R.string.pref_camera_tnr_default));
  if (CameraUtil.isSupported(tnr,CameraSettings.getSupportedTNRModes(mParameters))) {
    if (!tnr.equals(mActivity.getString(R.string.pref_camera_tnr_value_off))) {
      mParameters.set(CameraSettings.KEY_QC_CDS_MODE,mActivity.getString(R.string.pref_camera_cds_value_off));
      mUI.overrideSettings(CameraSettings.KEY_QC_CDS_MODE,mActivity.getString(R.string.pref_camera_cds_value_off));
      if (cds != null) {
        mPrevSavedCDS=cds;
      }
      isTNREnabled=true;
    }
 else     if (isTNREnabled) {
      mParameters.set(CameraSettings.KEY_QC_CDS_MODE,mPrevSavedCDS);
      mUI.overrideSettings(CameraSettings.KEY_QC_CDS_MODE,mPrevSavedCDS);
      isTNREnabled=false;
    }
    mParameters.set(CameraSettings.KEY_QC_TNR_MODE,tnr);
  }
  String hdrMode=mPreferences.getString(CameraSettings.KEY_HDR_MODE,mActivity.getString(R.string.pref_camera_hdr_mode_default));
  Log.v(TAG,"String_Node_Str" + hdrMode);
  if (CameraUtil.isSupported(hdrMode,CameraSettings.getSupportedHDRModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_SNAPCAM_HDR_MODE,hdrMode);
  }
  String hdrNeed1x=mPreferences.getString(CameraSettings.KEY_HDR_NEED_1X,mActivity.getString(R.string.pref_camera_hdr_need_1x_default));
  Log.v(TAG,"String_Node_Str" + hdrNeed1x);
  if (CameraUtil.isSupported(hdrNeed1x,CameraSettings.getSupportedHDRNeed1x(mParameters))) {
    mParameters.set(CameraSettings.KEY_SNAPCAM_HDR_NEED_1X,hdrNeed1x);
  }
  String advancedFeature=mPreferences.getString(CameraSettings.KEY_ADVANCED_FEATURES,mActivity.getString(R.string.pref_camera_advanced_feature_default));
  Log.e(TAG,"String_Node_Str" + advancedFeature);
  mRefocus=false;
  if (advancedFeature != null) {
    String ubiFocusOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_ubifocus_off);
    String chromaFlashOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_chromaflash_off);
    String optiZoomOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_optizoom_off);
    String reFocusOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_refocus_off);
    String fssrOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_FSSR_off);
    String truePortraitOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_trueportrait_off);
    String multiTouchFocusOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_multi_touch_focus_off);
    String stillMoreOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_stillmore_off);
    if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_ubifocus_on))) {
      qcomUpdateAdvancedFeatures(advancedFeature,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_chromaflash_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,advancedFeature,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_refocus_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,advancedFeature,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
      mRefocus=true;
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_optizoom_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,advancedFeature,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_FSSR_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,advancedFeature,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_trueportrait_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,advancedFeature,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_multi_touch_focus_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,advancedFeature,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_stillmore_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,advancedFeature);
    }
 else {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
  }
  if (mActivity.getString(R.string.pref_camera_advanced_feature_value_trueportrait_on).equals(advancedFeature)) {
    if (CameraUtil.isSupported(Parameters.FACE_DETECTION_ON,mParameters.getSupportedFaceDetectionModes())) {
      mActivity.runOnUiThread(new Runnable(){
        @Override public void run(){
          mUI.overrideSettings(CameraSettings.KEY_FACE_DETECTION,Parameters.FACE_DETECTION_ON);
        }
      }
);
      mParameters.setFaceDetectionMode(Parameters.FACE_DETECTION_ON);
      if (mFaceDetectionEnabled == false) {
        mFaceDetectionEnabled=true;
        startFaceDetection();
      }
    }
  }
 else {
    mActivity.runOnUiThread(new Runnable(){
      @Override public void run(){
        mUI.overrideSettings(CameraSettings.KEY_FACE_DETECTION,null);
      }
    }
);
    String faceDetection=mPreferences.getString(CameraSettings.KEY_FACE_DETECTION,mActivity.getString(R.string.pref_camera_facedetection_default));
    if (CameraUtil.isSupported(faceDetection,mParameters.getSupportedFaceDetectionModes())) {
      mParameters.setFaceDetectionMode(faceDetection);
      if (faceDetection.equals("String_Node_Str") && mFaceDetectionEnabled == false) {
        mFaceDetectionEnabled=true;
        startFaceDetection();
      }
      if (faceDetection.equals("String_Node_Str") && mFaceDetectionEnabled == true) {
        stopFaceDetection();
        mFaceDetectionEnabled=false;
      }
    }
  }
  String autoExposure=mPreferences.getString(CameraSettings.KEY_AUTOEXPOSURE,mActivity.getString(R.string.pref_camera_autoexposure_default));
  Log.v(TAG,"String_Node_Str" + autoExposure);
  if (CameraUtil.isSupported(autoExposure,mParameters.getSupportedAutoexposure())) {
    mParameters.setAutoExposure(autoExposure);
  }
  String antiBanding=mPreferences.getString(CameraSettings.KEY_ANTIBANDING,mActivity.getString(R.string.pref_camera_antibanding_default));
  Log.v(TAG,"String_Node_Str" + antiBanding);
  if (CameraUtil.isSupported(antiBanding,mParameters.getSupportedAntibanding())) {
    mParameters.setAntibanding(antiBanding);
  }
  String zsl=mPreferences.getString(CameraSettings.KEY_ZSL,mActivity.getString(R.string.pref_camera_zsl_default));
  String auto_hdr=mPreferences.getString(CameraSettings.KEY_AUTO_HDR,mActivity.getString(R.string.pref_camera_hdr_default));
  if (CameraUtil.isAutoHDRSupported(mParameters)) {
    mParameters.set("String_Node_Str",auto_hdr);
    if (auto_hdr.equals("String_Node_Str")) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mDrawAutoHDR != null) {
            mDrawAutoHDR.setVisibility(View.VISIBLE);
          }
        }
      }
);
      mParameters.setSceneMode("String_Node_Str");
      mCameraDevice.setMetadataCb(mMetaDataCallback);
    }
 else {
      mAutoHdrEnable=false;
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mDrawAutoHDR != null) {
            mDrawAutoHDR.setVisibility(View.INVISIBLE);
          }
        }
      }
);
    }
  }
  mParameters.setZSLMode(zsl);
  if (zsl.equals("String_Node_Str")) {
    mSnapshotMode=CameraInfo.CAMERA_SUPPORT_MODE_ZSL;
    mParameters.setCameraMode(1);
    mFocusManager.setZslEnable(true);
    mParameters.set(KEY_PICTURE_FORMAT,PIXEL_FORMAT_JPEG);
    if (CameraUtil.isSupported(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,mParameters.getSupportedFocusModes()) && !mFocusManager.isTouch()) {
      mFocusManager.overrideFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
      mParameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
    }
 else     if (mFocusManager.isTouch()) {
      mFocusManager.overrideFocusMode(null);
      mParameters.setFocusMode(mFocusManager.getFocusMode());
    }
 else {
      mFocusManager.overrideFocusMode(mFocusManager.getFocusMode());
    }
    if (!pictureFormat.equals(PIXEL_FORMAT_JPEG)) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          RotateTextToast.makeText(mActivity,R.string.error_app_unsupported_raw,Toast.LENGTH_SHORT).show();
        }
      }
);
    }
  }
 else   if (zsl.equals("String_Node_Str")) {
    mSnapshotMode=CameraInfo.CAMERA_SUPPORT_MODE_NONZSL;
    mParameters.setCameraMode(0);
    mFocusManager.setZslEnable(false);
    if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
      mFocusManager.overrideFocusMode(null);
      mParameters.setFocusMode(mFocusManager.getFocusMode());
    }
  }
  String histogram=mPreferences.getString(CameraSettings.KEY_HISTOGRAM,mActivity.getString(R.string.pref_camera_histogram_default));
  if (CameraUtil.isSupported(histogram,mParameters.getSupportedHistogramModes()) && mCameraDevice != null) {
    if (histogram.equals("String_Node_Str")) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mGraphView != null) {
            mGraphView.setVisibility(View.VISIBLE);
            mGraphView.PreviewChanged();
          }
        }
      }
);
      mCameraDevice.setHistogramMode(mStatsCallback);
      mHiston=true;
    }
 else {
      mHiston=false;
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mGraphView != null)           mGraphView.setVisibility(View.INVISIBLE);
        }
      }
);
      mCameraDevice.setHistogramMode(null);
    }
  }
  setFlipValue();
  String aeBracket=mParameters.get(CameraSettings.KEY_QC_AE_BRACKETING);
  if (!aeBracket.equalsIgnoreCase("String_Node_Str")) {
    String fMode=Parameters.FLASH_MODE_OFF;
    mParameters.setFlashMode(fMode);
  }
}

Fixed version (ground truth):
/** 
 * This can run on a background thread, so don't do UI updates here.
 */
private void qcomUpdateCameraParametersPreference(){
  mParameters.set("String_Node_Str",String.valueOf(mbrightness));
  String longshot_enable=mPreferences.getString(CameraSettings.KEY_LONGSHOT,mActivity.getString(R.string.pref_camera_longshot_default));
  mParameters.set("String_Node_Str",longshot_enable);
  String optizoomOn=mActivity.getString(R.string.pref_camera_advanced_feature_value_optizoom_on);
  if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode) || CameraUtil.SCENE_MODE_HDR.equals(mSceneMode) || optizoomOn.equals(mSceneMode)) {
    String touchAfAec=mPreferences.getString(CameraSettings.KEY_TOUCH_AF_AEC,mActivity.getString(R.string.pref_camera_touchafaec_default));
    if (CameraUtil.isSupported(touchAfAec,mParameters.getSupportedTouchAfAec())) {
      mCurrTouchAfAec=touchAfAec;
      mParameters.setTouchAfAec(touchAfAec);
    }
  }
 else {
    mParameters.setTouchAfAec(mParameters.TOUCH_AF_AEC_OFF);
    mFocusManager.resetTouchFocus();
  }
  try {
    if (mParameters.getTouchAfAec().equals(mParameters.TOUCH_AF_AEC_ON))     this.mTouchAfAecFlag=true;
 else     this.mTouchAfAecFlag=false;
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str");
  }
  String pictureFormat=mPreferences.getString(CameraSettings.KEY_PICTURE_FORMAT,mActivity.getString(R.string.pref_camera_picture_format_default));
  if (mIsImageCaptureIntent && !pictureFormat.equals(PIXEL_FORMAT_JPEG)) {
    pictureFormat=PIXEL_FORMAT_JPEG;
    Editor editor=mPreferences.edit();
    editor.putString(CameraSettings.KEY_PICTURE_FORMAT,mActivity.getString(R.string.pref_camera_picture_format_value_jpeg));
    editor.apply();
  }
  Log.v(TAG,"String_Node_Str" + pictureFormat);
  mParameters.set(KEY_PICTURE_FORMAT,pictureFormat);
  String jpegQuality=mPreferences.getString(CameraSettings.KEY_JPEG_QUALITY,mActivity.getString(R.string.pref_camera_jpegquality_default));
  Size pic_size=mParameters.getPictureSize();
  if (pic_size == null) {
    Log.e(TAG,"String_Node_Str");
  }
 else {
    if ("String_Node_Str".equals(jpegQuality) && (pic_size.width >= 3200)) {
    }
 else {
      mParameters.setJpegQuality(JpegEncodingQualityMappings.getQualityNumber(jpegQuality));
      int jpegFileSize=estimateJpegFileSize(pic_size,jpegQuality);
      if (jpegFileSize != mJpegFileSizeEstimation) {
        mJpegFileSizeEstimation=jpegFileSize;
        mHandler.post(new Runnable(){
          @Override public void run(){
            updateRemainingPhotos();
          }
        }
);
      }
    }
  }
  String selectableZoneAf=mPreferences.getString(CameraSettings.KEY_SELECTABLE_ZONE_AF,mActivity.getString(R.string.pref_camera_selectablezoneaf_default));
  List<String> str=mParameters.getSupportedSelectableZoneAf();
  if (CameraUtil.isSupported(selectableZoneAf,mParameters.getSupportedSelectableZoneAf())) {
    mParameters.setSelectableZoneAf(selectableZoneAf);
  }
  if (mParameters.getSupportedDenoiseModes() != null) {
    String Denoise=mPreferences.getString(CameraSettings.KEY_DENOISE,mActivity.getString(R.string.pref_camera_denoise_default));
    mParameters.setDenoise(Denoise);
  }
  String redeyeReduction=mPreferences.getString(CameraSettings.KEY_REDEYE_REDUCTION,mActivity.getString(R.string.pref_camera_redeyereduction_default));
  if (CameraUtil.isSupported(redeyeReduction,mParameters.getSupportedRedeyeReductionModes())) {
    mParameters.setRedeyeReductionMode(redeyeReduction);
  }
  if ((mManual3AEnabled & MANUAL_EXPOSURE) == 0) {
    String iso=mPreferences.getString(CameraSettings.KEY_ISO,mActivity.getString(R.string.pref_camera_iso_default));
    if (CameraUtil.isSupported(iso,mParameters.getSupportedIsoValues())) {
      mParameters.setISOValue(iso);
    }
  }
  String colorEffect=mPreferences.getString(CameraSettings.KEY_COLOR_EFFECT,mActivity.getString(R.string.pref_camera_coloreffect_default));
  Log.v(TAG,"String_Node_Str" + colorEffect);
  if (CameraUtil.isSupported(colorEffect,mParameters.getSupportedColorEffects())) {
    mParameters.setColorEffect(colorEffect);
  }
  String saturationStr=mPreferences.getString(CameraSettings.KEY_SATURATION,mActivity.getString(R.string.pref_camera_saturation_default));
  int saturation=Integer.parseInt(saturationStr);
  Log.v(TAG,"String_Node_Str" + saturation);
  if ((0 <= saturation) && (saturation <= mParameters.getMaxSaturation())) {
    mParameters.setSaturation(saturation);
  }
  String contrastStr=mPreferences.getString(CameraSettings.KEY_CONTRAST,mActivity.getString(R.string.pref_camera_contrast_default));
  int contrast=Integer.parseInt(contrastStr);
  Log.v(TAG,"String_Node_Str" + contrast);
  if ((0 <= contrast) && (contrast <= mParameters.getMaxContrast())) {
    mParameters.setContrast(contrast);
  }
  String sharpnessStr=mPreferences.getString(CameraSettings.KEY_SHARPNESS,mActivity.getString(R.string.pref_camera_sharpness_default));
  int sharpness=Integer.parseInt(sharpnessStr) * (mParameters.getMaxSharpness() / MAX_SHARPNESS_LEVEL);
  Log.v(TAG,"String_Node_Str" + sharpness);
  if ((0 <= sharpness) && (sharpness <= mParameters.getMaxSharpness())) {
    mParameters.setSharpness(sharpness);
  }
  String faceRC=mPreferences.getString(CameraSettings.KEY_FACE_RECOGNITION,mActivity.getString(R.string.pref_camera_facerc_default));
  Log.v(TAG,"String_Node_Str" + faceRC);
  if (CameraUtil.isSupported(faceRC,CameraSettings.getSupportedFaceRecognitionModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_QC_FACE_RECOGNITION,faceRC);
  }
  String aeBracketing=mPreferences.getString(CameraSettings.KEY_AE_BRACKET_HDR,mActivity.getString(R.string.pref_camera_ae_bracket_hdr_default));
  Log.v(TAG,"String_Node_Str" + aeBracketing);
  if (CameraUtil.isSupported(aeBracketing,CameraSettings.getSupportedAEBracketingModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_QC_AE_BRACKETING,aeBracketing);
  }
  String cds=mPreferences.getString(CameraSettings.KEY_CDS_MODE,mActivity.getString(R.string.pref_camera_cds_default));
  if ((mPrevSavedCDS == null) && (cds != null)) {
    mPrevSavedCDS=cds;
  }
  if (CameraUtil.isSupported(cds,CameraSettings.getSupportedCDSModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_QC_CDS_MODE,cds);
  }
  String tnr=mPreferences.getString(CameraSettings.KEY_TNR_MODE,mActivity.getString(R.string.pref_camera_tnr_default));
  if (CameraUtil.isSupported(tnr,CameraSettings.getSupportedTNRModes(mParameters))) {
    if (!tnr.equals(mActivity.getString(R.string.pref_camera_tnr_value_off))) {
      mParameters.set(CameraSettings.KEY_QC_CDS_MODE,mActivity.getString(R.string.pref_camera_cds_value_off));
      mActivity.runOnUiThread(new Runnable(){
        @Override public void run(){
          mUI.overrideSettings(CameraSettings.KEY_QC_CDS_MODE,mActivity.getString(R.string.pref_camera_cds_value_off));
        }
      }
);
      if (cds != null) {
        mPrevSavedCDS=cds;
      }
      isTNREnabled=true;
    }
 else     if (isTNREnabled) {
      mParameters.set(CameraSettings.KEY_QC_CDS_MODE,mPrevSavedCDS);
      mActivity.runOnUiThread(new Runnable(){
        @Override public void run(){
          mUI.overrideSettings(CameraSettings.KEY_QC_CDS_MODE,mPrevSavedCDS);
        }
      }
);
      isTNREnabled=false;
    }
    mParameters.set(CameraSettings.KEY_QC_TNR_MODE,tnr);
  }
  String hdrMode=mPreferences.getString(CameraSettings.KEY_HDR_MODE,mActivity.getString(R.string.pref_camera_hdr_mode_default));
  Log.v(TAG,"String_Node_Str" + hdrMode);
  if (CameraUtil.isSupported(hdrMode,CameraSettings.getSupportedHDRModes(mParameters))) {
    mParameters.set(CameraSettings.KEY_SNAPCAM_HDR_MODE,hdrMode);
  }
  String hdrNeed1x=mPreferences.getString(CameraSettings.KEY_HDR_NEED_1X,mActivity.getString(R.string.pref_camera_hdr_need_1x_default));
  Log.v(TAG,"String_Node_Str" + hdrNeed1x);
  if (CameraUtil.isSupported(hdrNeed1x,CameraSettings.getSupportedHDRNeed1x(mParameters))) {
    mParameters.set(CameraSettings.KEY_SNAPCAM_HDR_NEED_1X,hdrNeed1x);
  }
  String advancedFeature=mPreferences.getString(CameraSettings.KEY_ADVANCED_FEATURES,mActivity.getString(R.string.pref_camera_advanced_feature_default));
  Log.e(TAG,"String_Node_Str" + advancedFeature);
  mRefocus=false;
  if (advancedFeature != null) {
    String ubiFocusOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_ubifocus_off);
    String chromaFlashOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_chromaflash_off);
    String optiZoomOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_optizoom_off);
    String reFocusOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_refocus_off);
    String fssrOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_FSSR_off);
    String truePortraitOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_trueportrait_off);
    String multiTouchFocusOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_multi_touch_focus_off);
    String stillMoreOff=mActivity.getString(R.string.pref_camera_advanced_feature_value_stillmore_off);
    if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_ubifocus_on))) {
      qcomUpdateAdvancedFeatures(advancedFeature,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_chromaflash_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,advancedFeature,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_refocus_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,advancedFeature,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
      mRefocus=true;
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_optizoom_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,advancedFeature,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_FSSR_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,advancedFeature,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_trueportrait_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,advancedFeature,multiTouchFocusOff,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_multi_touch_focus_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,advancedFeature,stillMoreOff);
    }
 else     if (advancedFeature.equals(mActivity.getString(R.string.pref_camera_advanced_feature_value_stillmore_on))) {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,advancedFeature);
    }
 else {
      qcomUpdateAdvancedFeatures(ubiFocusOff,chromaFlashOff,reFocusOff,optiZoomOff,fssrOff,truePortraitOff,multiTouchFocusOff,stillMoreOff);
    }
  }
  if (mActivity.getString(R.string.pref_camera_advanced_feature_value_trueportrait_on).equals(advancedFeature)) {
    if (CameraUtil.isSupported(Parameters.FACE_DETECTION_ON,mParameters.getSupportedFaceDetectionModes())) {
      mActivity.runOnUiThread(new Runnable(){
        @Override public void run(){
          mUI.overrideSettings(CameraSettings.KEY_FACE_DETECTION,Parameters.FACE_DETECTION_ON);
        }
      }
);
      mParameters.setFaceDetectionMode(Parameters.FACE_DETECTION_ON);
      if (mFaceDetectionEnabled == false) {
        mFaceDetectionEnabled=true;
        startFaceDetection();
      }
    }
  }
 else {
    mActivity.runOnUiThread(new Runnable(){
      @Override public void run(){
        mUI.overrideSettings(CameraSettings.KEY_FACE_DETECTION,null);
      }
    }
);
    String faceDetection=mPreferences.getString(CameraSettings.KEY_FACE_DETECTION,mActivity.getString(R.string.pref_camera_facedetection_default));
    if (CameraUtil.isSupported(faceDetection,mParameters.getSupportedFaceDetectionModes())) {
      mParameters.setFaceDetectionMode(faceDetection);
      if (faceDetection.equals("String_Node_Str") && mFaceDetectionEnabled == false) {
        mFaceDetectionEnabled=true;
        startFaceDetection();
      }
      if (faceDetection.equals("String_Node_Str") && mFaceDetectionEnabled == true) {
        stopFaceDetection();
        mFaceDetectionEnabled=false;
      }
    }
  }
  String autoExposure=mPreferences.getString(CameraSettings.KEY_AUTOEXPOSURE,mActivity.getString(R.string.pref_camera_autoexposure_default));
  Log.v(TAG,"String_Node_Str" + autoExposure);
  if (CameraUtil.isSupported(autoExposure,mParameters.getSupportedAutoexposure())) {
    mParameters.setAutoExposure(autoExposure);
  }
  String antiBanding=mPreferences.getString(CameraSettings.KEY_ANTIBANDING,mActivity.getString(R.string.pref_camera_antibanding_default));
  Log.v(TAG,"String_Node_Str" + antiBanding);
  if (CameraUtil.isSupported(antiBanding,mParameters.getSupportedAntibanding())) {
    mParameters.setAntibanding(antiBanding);
  }
  String zsl=mPreferences.getString(CameraSettings.KEY_ZSL,mActivity.getString(R.string.pref_camera_zsl_default));
  String auto_hdr=mPreferences.getString(CameraSettings.KEY_AUTO_HDR,mActivity.getString(R.string.pref_camera_hdr_default));
  if (CameraUtil.isAutoHDRSupported(mParameters)) {
    mParameters.set("String_Node_Str",auto_hdr);
    if (auto_hdr.equals("String_Node_Str")) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mDrawAutoHDR != null) {
            mDrawAutoHDR.setVisibility(View.VISIBLE);
          }
        }
      }
);
      mParameters.setSceneMode("String_Node_Str");
      mCameraDevice.setMetadataCb(mMetaDataCallback);
    }
 else {
      mAutoHdrEnable=false;
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mDrawAutoHDR != null) {
            mDrawAutoHDR.setVisibility(View.INVISIBLE);
          }
        }
      }
);
    }
  }
  mParameters.setZSLMode(zsl);
  if (zsl.equals("String_Node_Str")) {
    mSnapshotMode=CameraInfo.CAMERA_SUPPORT_MODE_ZSL;
    mParameters.setCameraMode(1);
    mFocusManager.setZslEnable(true);
    mParameters.set(KEY_PICTURE_FORMAT,PIXEL_FORMAT_JPEG);
    if (CameraUtil.isSupported(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,mParameters.getSupportedFocusModes()) && !mFocusManager.isTouch()) {
      mFocusManager.overrideFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
      mParameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
    }
 else     if (mFocusManager.isTouch()) {
      mFocusManager.overrideFocusMode(null);
      mParameters.setFocusMode(mFocusManager.getFocusMode());
    }
 else {
      mFocusManager.overrideFocusMode(mFocusManager.getFocusMode());
    }
    if (!pictureFormat.equals(PIXEL_FORMAT_JPEG)) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          RotateTextToast.makeText(mActivity,R.string.error_app_unsupported_raw,Toast.LENGTH_SHORT).show();
        }
      }
);
    }
  }
 else   if (zsl.equals("String_Node_Str")) {
    mSnapshotMode=CameraInfo.CAMERA_SUPPORT_MODE_NONZSL;
    mParameters.setCameraMode(0);
    mFocusManager.setZslEnable(false);
    if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
      mFocusManager.overrideFocusMode(null);
      mParameters.setFocusMode(mFocusManager.getFocusMode());
    }
  }
  String histogram=mPreferences.getString(CameraSettings.KEY_HISTOGRAM,mActivity.getString(R.string.pref_camera_histogram_default));
  if (CameraUtil.isSupported(histogram,mParameters.getSupportedHistogramModes()) && mCameraDevice != null) {
    if (histogram.equals("String_Node_Str")) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mGraphView != null) {
            mGraphView.setVisibility(View.VISIBLE);
            mGraphView.PreviewChanged();
          }
        }
      }
);
      mCameraDevice.setHistogramMode(mStatsCallback);
      mHiston=true;
    }
 else {
      mHiston=false;
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          if (mGraphView != null)           mGraphView.setVisibility(View.INVISIBLE);
        }
      }
);
      mCameraDevice.setHistogramMode(null);
    }
  }
  setFlipValue();
  String aeBracket=mParameters.get(CameraSettings.KEY_QC_AE_BRACKETING);
  if (!aeBracket.equalsIgnoreCase("String_Node_Str")) {
    String fMode=Parameters.FLASH_MODE_OFF;
    mParameters.setFlashMode(fMode);
  }
}