[HTC ChaCha] adlx.xda:
http://logcat.miui.us/907002 shows:

2047 private void setPreviewDisplay(SurfaceHolder holder) {
2048 try {
2049 mCameraDevice.setPreviewDisplay(holder);
2050 } catch (Throwable ex) {
2051 closeCamera();
2052 throw new RuntimeException("setPreviewDisplay failed", ex); // <------
2053 }
2054 }

public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// Make sure we have a surface in the holder before proceeding.
if (holder.getSurface() == null) {
Log.d(TAG, "holder.getSurface() == null");
return;
}

Log.v(TAG, "surfaceChanged. w=" + w + ". h=" + h);

// We need to save the holder for later use, even when the mCameraDevice
// is null. This could happen if onResume() is invoked after this
// function.
mSurfaceHolder = holder;

VERBOSE/camera(832): surfaceChanged. w=320. h=427

118:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): requested preview size 480 x 320

119:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): requested picture size 2560 x 1920

120:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): requested Fps Range min: 9000 x max: 30000

121:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): setGpsLocation: E

122:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): not defined touch-focus yet, or AP without touch-focus function

123:	07-11 01:54:31.151: INFO/QualcommCameraHardware(98): Before Setting coordinate x:240 y:160

124:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): setThumbnailSize w=640 h=480

125:	07-11 01:54:31.151: DEBUG/QualcommCameraHardware(98): virtual android::status_t android::QualcommCameraHardware::setParameters(const android::CameraParameters&), final_rc=0

126:	07-11 01:54:31.181: VERBOSE/camera(832): Preview size is 480x320

Vs w/ Aria libs: VERBOSE/camera(828): Preview size is 384x288 <-- smaller!! (would fit in the surface 427x320!)

preview-size-values=800x480,720x480,768x432,640x480,640x384,576x432,480x320,240x160

preview-size=480x320

./frameworks/base/libs/camera/CameraParameters.cpp :

597 void CameraParameters::setPreviewSize(int width, int height)
598 {
599 char str[32];
600 snprintf(str, sizeof(str), "%dx%d", width, height);
601 set(KEY_PREVIEW_SIZE, str);
602 }
603
604 void CameraParameters::getPreviewSize(int *width, int *height) const
605 {
606 *width = *height = -1;
607 // Get the current string, if it doesn't exist, leave the -1x-1
608 const char *p = get(KEY_PREVIEW_SIZE);
609 if (p == 0) return;
610 parse_pair(p, width, height, 'x');
611 }

./src/com/android/camera/Camera.java :

2200 // Set a preview size that is closest to the viewfinder height and has
2201 // the right aspect ratio.
2202 List<Size> sizes = mParameters.getSupportedPreviewSizes();
2203 Size optimalSize = Util.getOptimalPreviewSize(this,
2204 sizes, (double) size.width / size.height);
2205 Size original = mParameters.getPreviewSize();
2206 if (!original.equals(optimalSize)) {
2207 mParameters.setPreviewSize(optimalSize.width, optimalSize.height);
2208
2209 // If preview is running, stop preview and let startPreview call
2210 // this function again because we cannot change size on the fly
2211 if (mCameraState != PREVIEW_STOPPED) {
2212 stopPreview();
2213 startPreview();
2214 return;
2215 }
2216
2217 // Zoom related settings will be changed for different preview
2218 // sizes, so set and read the parameters to get lastest values
2219 mCameraDevice.setParameters(mParameters);
2220 mParameters = mCameraDevice.getParameters();
2221 }
2222 Log.v(TAG, "Preview size is " + optimalSize.width + "x" + optimalSize.height);

--> in the Logcat I see this line, from Camera.java:2222 :

07-11 01:54:31.181: VERBOSE/camera(832): Preview size is 480x320

Looking at Util.getOptimalPreviewSize --> maybe it tried to fit with a 90º rotation... :(

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** display.getHeight=480, display.getWidth=320

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=480, size.width=800

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=480, size.width=720

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=432, size.width=768

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=480, size.width=640

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=384, size.width=640

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=432, size.width=576

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=320, size.width=480

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** size.height=160, size.width=240

07-12 19:41:17.495: DEBUG/Util(810): ***ALEX*** optimalSize.height=320, optimalSize.width=480

07-12 19:45:14.977: INFO/power(169): *** set_screen_state 0

Where display is the screen (seen by the camera app) --> rotated 90º (but it's normal, as the App is launched rotated :-/ ).

All the preview sizes from the preview-size-values list are correct (landscape orientation).