Change device default orientation

I wanted to ask if it is possible to change the device default orientation to portrait, so that the bootlogo, the bootanimation and OS (Android) are all displayed in portrait. I searched a lot and couldn‘t find anything and still experimenting with the source code. I hope someone can help me.

hi ,look in settings /display settings
also make sure that you have the latest or penultimate version of Android, there I saw the settings you need, this is with regard to OS

Hi, I saw that setting but when I change it to 270, the os starts in landscape and then switches to portrait. I want the OS to start in portrait and then stay in portrait.

Ok I solved the problem by forcing Portrait in DisplayDevice.cpp and SurfaceFlinger.cpp which are located in /frameworks\native\services\surfaceflinger

the khadas logo is still landscape but this can be fixed by rotating the logo


Did you edit the source? You can describe your steps in more detail.

Yeah I edited the source, but can’t remember exactly what I edited. I don’t have access to the source anymore, sorry.

I am doing this. I hope I will get it done.
Has anyone done this before??
I want to set portrait on boot.

I did it.
Was able to change the orientation on boot.
Thanx @3id_L

1 Like