Camera Orientation issue: Android Pie default Camera application

Skip to first unread message

Devendra Devadiga

Mar 12, 2021, 10:43:33 AM3/12/21
to android-porting

I am using an (Android Pie) AOSP Camera2  application. (packages/apps/Camera2)

I am working on NXP's i.MX8MMini board with Android Pie AOSP.

We are using Camera module OV5640 as back camera module. Able to preview and capture the image and video in reverse landscape mode.
But the mechanical enclosure fitting camera module rotated 90 degrees right physically.
And in camera application for preview, image is coming as 90 degree left.

Please can you help on this ? What changes I need to do in the Hardware layer?

I had posted complete issue details in this link with physical camera image sensor.

The camera sensor in the image is uased as back camera.

In init.rc file I changed below line :


setprop back_camera_orient 0 ==> setprop back_camera_orient 90

But still not working.

I traced where this values is parsing and got this:

vendor/nxp-opensource/imx/libcamera3/CameraHAL.cpp:316:    property_get("back_camera_name", mSets[BACK_CAMERA_ID].mPropertyName, "0");

In NXP's libcamera3 layer parsing values happening but finally how it effect to camera orientation I didn't get.

Please can anyone check this and help me ?

Thanks and Regards,


Mar 17, 2021, 7:11:16 PM3/17/21
to android-porting
Hi. I have working with basically the same configuration. Since the OV5640 has a flip logic at camera level, my suggestion is to edit the kernel driver in order to set the flip parameter at 90 (or 270, depending on the orientation) degree. If needed, it support also mirroring of the image. They should be flags on configuration registers. In this way there is no need to work at OS level or HAL level.

Devendra Devadiga

Mar 18, 2021, 12:15:38 PM3/18/21
to android-porting
Thank you for your reply.
I tried to change the "mirror and flip" registers in driver level previously. But OV5640 only supports 180 degrees flip and with register combination I am able to flip to 180 degrees.
90 degrees and 270 degrees I didn't able to rotate with any combination of "mirror and flip" register values. I checked in datasheet of ov5640 and got the information like it will support only 180 degrees rotation. I had attached the image.

If you are able to configure  for 90 degrees or 270 degrees, please can you share those register combinations ?

Thanks and Regards,

aung ko win

Mar 23, 2021, 12:24:40 PM3/23/21
to, android-porting

You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages