Sets right preview frame properties.

Don't cofuse preview window with preview frames. Preview frames are relevant only
in panoramic mode that receives frames via CAMERA_MSG_PREVIEW_FRAME callback.

Change-Id: Ibecb345e43ba452856b8ca75449264d8d354a9d5
diff --git a/tools/emulator/system/camera/EmulatedCamera.cpp b/tools/emulator/system/camera/EmulatedCamera.cpp
index b8cec0e..9cabe75 100755
--- a/tools/emulator/system/camera/EmulatedCamera.cpp
+++ b/tools/emulator/system/camera/EmulatedCamera.cpp
@@ -92,11 +92,6 @@
      * Fake required parameters.
      */
 
-    /* Only RGBX are supported by the framework for preview window in the emulator! */
-    mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS, CameraParameters::PIXEL_FORMAT_RGBA8888);
-    mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES, "60,50,25,15,10");
-    mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, "(10,60)");
-    mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, "10,60");
     mParameters.set(CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES, "320x240,0x0");
     mParameters.set(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "6");
     mParameters.set(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-6");
@@ -109,8 +104,13 @@
     mParameters.set(CameraParameters::KEY_VERTICAL_VIEW_ANGLE, "42.5");
     mParameters.set(CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY, "90");
 
-    /* Only RGB formats are supported by preview window in emulator. */
-    mParameters.setPreviewFormat(CameraParameters::PIXEL_FORMAT_RGBA8888);
+    /* Preview format settings used here are related to panoramic view only. It's
+     * not related to the preview window that works only with RGB frames, which
+     * is explicitly stated when set_buffers_geometry is called on the preview
+     * window object. */
+    mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS,
+                    CameraParameters::PIXEL_FORMAT_YUV420SP);
+    mParameters.setPreviewFormat(CameraParameters::PIXEL_FORMAT_YUV420SP);
 
     /* We don't relay on the actual frame rates supported by the camera device,
      * since we will emulate them through timeouts in the emulated camera device
diff --git a/tools/emulator/system/camera/PreviewWindow.cpp b/tools/emulator/system/camera/PreviewWindow.cpp
index c4f6f80..fb708d5 100755
--- a/tools/emulator/system/camera/PreviewWindow.cpp
+++ b/tools/emulator/system/camera/PreviewWindow.cpp
@@ -121,9 +121,9 @@
              __FUNCTION__, mPreviewWindow, mPreviewFrameWidth,
              mPreviewFrameHeight);
         res = mPreviewWindow->set_buffers_geometry(mPreviewWindow,
-                                                    mPreviewFrameWidth,
-                                                    mPreviewFrameHeight,
-                                                    HAL_PIXEL_FORMAT_RGBA_8888);
+                                                   mPreviewFrameWidth,
+                                                   mPreviewFrameHeight,
+                                                   HAL_PIXEL_FORMAT_RGBA_8888);
         if (res != NO_ERROR) {
             LOGE("%s: Error in set_buffers_geometry %d -> %s",
                  __FUNCTION__, -res, strerror(-res));