This is already done in the CameraView, in the getOptimalPreviewSize. Why this is needed here?