My question is very simple:
How to get an Android
android.hardware.Camera2
with 1:1 ratio and without deformation like Instagram?
I did it with the Layout, in that way, google code can be keeped as it comes and automatically set a 1:1 preview based on the UI.
Just put the AutoFitTextureView inside a ConstraintLayout and then
previewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
width, height, videoSize);
does all the magic