With android.hardware.Camera, in order to have the camera output appropriately track the device movement, we need to hook up an OrientationEventListener>
There is none.
It does not "just work" if display orientation is swapped compared to sensor orientation (on most devices this is the case in portrait mode) because you have to set an aspect ratio < 1 for your preview surface that camera2 cannot map to a fitting output size. Solution: