I'm still not confident that this isLarger calculation is correct.  On all devices I've seen, with a sensor angle of 90, the previewSizes array holds objects where width is the larger dimension and height is the smaller dimension.

If the sensorAngle is 180 or 0, this code only works if width is the smaller dimension and height is the larger dimension.  But I don't have a device that I can verify that assumption on, so I cannot tell whether the code will work correctly.