cameraview
cameraview copied to clipboard
Fix app:aspectRatio not working at Camera2
When device has Camera2 API (whether Camera2 class expected to successfully initialized or not), app:aspectRatio value is passed following CameraView(Context, AttributeSet, int), CameraView#setAspectRatio(AspectRatio) and Camera2#setAspectRatio(AspectRatio).
In Camera2#setAspectRatio(AspectRatio), checking ratio is exists in mPreviewSizes but it is initializing when Camera2#start().
Therefore mPreviewSizes has no value, so reaching return false and aspect ratio keeps 4:3 (default value).