private void expandParams(Bundle params) {
   if (params == null) {
     params = new Bundle();
   }
   int id = 0;
   if (params.containsKey(RATIO)) {
     id = params.getInt(RATIO, 1);
   }
   ratio = Ratio.getRatioById(id);
   id = 0;
   if (params.containsKey(QUALITY)) {
     id = params.getInt(QUALITY, 0);
   }
   quality = Quality.getQualityById(id);
   id = 0;
   if (params.containsKey(FOCUS_MODE)) {
     id = params.getInt(FOCUS_MODE);
   }
   focusMode = FocusMode.getFocusModeById(id);
   id = 0;
   if (params.containsKey(FLASH_MODE)) {
     id = params.getInt(FLASH_MODE);
   }
   flashMode = FlashMode.getFlashModeById(id);
   id = 0;
   if (params.containsKey(HDR_MODE)) {
     id = params.getInt(HDR_MODE);
   }
   hdrMode = HDRMode.getHDRModeById(id);
 }
 @Override
 public void onFocusModeChanged(int id) {
   focusMode = FocusMode.getFocusModeById(id);
   cameraPreview.setFocusMode(focusMode);
   if (paramsChangedListener != null) {
     paramsChangedListener.onFocusModeChanged(id);
   }
 }
  private Bundle packSettings() {
    Bundle params = new Bundle();

    params.putInt(QUALITY, quality.getId());
    params.putInt(RATIO, ratio.getId());
    params.putInt(FOCUS_MODE, focusMode.getId());
    params.putInt(HDR_MODE, hdrMode.getId());
    return params;
  }