Don't panic if Nexus 5X camera apps show inverted images

If you're using your favorite non-Nexus third party camera app on your shiny new Nexus 5X and are surprised to discover your photos upside down, don't panic. It's not a hardware flaw. And it's not a software bug either. Well, at least not completely. The Nexus 5X camera module is indeed oriented in an unconventional way, but don't worry, that is as intended. The problem unfortunately lies with these third party camera apps aren't using the latest Camera2 API, which has resulted in no small amount of shock and confusion for users.

Android has a set of guidelines (PDF) device manufacturers need to follow in order to receive Google's blessing. One of those requires that the long edge of the camera sensor aligns with the long dimension of the screen:

"Both front- and rear-facing cameras, if present, MUST be oriented so that the long dimension of the camera aligns with the screen's long dimension. That is, when the device is held in the landscape orientation, cameras MUST capture images in the landscape orientation. This applies regardless of the device's natural orientation; that is, it applies to landscape-primary devices as well as portraitprimary devices."

The compatibility guidelines, however, do not say what orientation the sensor should take. The "forward" orientation is the norm in the industry by convention, but Android doesn't exclude the "reverse" orientation. In fact, that is the orientation that Google used for the Nexus 5X rear camera and even the Nexus 6 (not 6P) front camera. Google needed to do this to save space on the Nexus 5X. Otherwise the otherwise decent camera would have had to be downgraded to fit.

The problem then lies with the older camera API that majority of apps still use today. This API, basically the vocabulary of commands developers use to talk to the Android platform, required developers to set the camera orientation themselves. The default orientation, however, happens to coincide with the "correct" orientation for a forward landscape camera sensor. And since the opposite orientation is rare, developers simply ignored that case. At least until now.

Google urges camera app developers to switch over to the new camera2 API, where all of this is automatically done for the developers. That said, if for some reason they can't do so, they will have to do the heavy lifting themselves to make sure their apps still work on the Nexus 5X, or any future smartphone that has an unconventional build as well.

Image courtesy of iFixit

SOURCE: Reddit