I run into the same issue with my Nexus 5x. This problem actually can be addressed without
upgrading to camera2 API (See
details on how to do this with the old camera API).
I checked freeotp sources and it already contains the suggested workaround code! I could
not understand why I can see the picture upside down even though the code is already in
freeotp until I found a bug in a different part of ScanningActivity.
On my Nexus 5x, this bug causes the ScanningActivity to read and use properties (such as
orientation) of the front camera although it is the rear camera that is actually used for
preview and scanning. As a result, orientation is not properly calculated.
The fix is really simple and can be found here: