I have tested new Camera2 API on Android Lollipop. I want to fetch supported preview size:
StreamConfigurationMap streamConfigurationMap = cameraCharacterist
replace
Size[] sizes = streamConfigurationMap.getOutputSizes(SurfaceTexture.class);
to
Size[] sizes = streamConfigurationMap.getOutputSizes(ImageFormat.JPEG)