I have my device running android Jellybean 4.2.2 with Landscape as the default/natural orientation.

How can I change the default/natural orientation of the same to portrait?

Here is what I have tried till now,

1) Added setprop ro.sf.hwrotation 90 to build.prop and it did nothing.

2) changed user_rotation value in /data/data/com.android.providers.settings/databases/settings.db and it changed the orientation of apps only. the orientation of Home screen and launcher are still landscape.

3) Modified PhoneWindowManager.java similar to the one given in link : changing phonewindowmanager to change natural orientation

The third option works. But it still shows the bootanimation in landscape and after the animation is finished, the display rotates(with rotate animation) to portrait. How can I avoid this rotation and change the default/natural orientation before boot animation?

Is it something related to SurfaceFlinger? I would also like to point to this article in android website. pre rotation in hardware composer


3 Answers 3


The boot animation wont change since the boot animation where a series of images. In /system/media you will find the bootanimation.zip if you open the zip you will find the images replace the zip with your own boot animation of portrait images. There are plenty of tutorial on how to make your own boot animation.

  • Thanks. I have already did that work around. As bootanimation a series of images, I have used my own portrait images and overridden the bootanimation to look like, it is portrait screen. But the real problem is after the bootanimation it rotates from landscape to portrait. I dont want it to show landscape at all. I need it portrait from the moment or before the boot animation exits. Commented Apr 16, 2014 at 9:58
  • android.stackexchange.com/questions/10808/… did u try this?
    – samnaction
    Commented Apr 16, 2014 at 10:00
  • Yes i did. The second option i have given in the question explains the same. Commented Apr 16, 2014 at 10:05
  • I hope there is a generic solution for this. May be some changes in surfaceFlinger , inputReader or something like framebuffer rotation. Commented Apr 16, 2014 at 10:07

Working Android 4.2.1 method.
Tab or phone must be ROOT.

Dowloand in playstore : Root Browser
Dowloand in playstore : ES File Explorer

Open Root Browser and go to : system folder.
Then show file : build.prop and touch it long time.

in menu choose : Copy and past file in your internal or external sd card.

In Root Browser open build.prop copied file with ES File Explorer
Then modify entry : ro.sf.hwrotation=0
Must be 90 to setup default landscape mode :


In ES File Explorer save build.prop file.

Open Root Browser, go to system folder.

Delete (by menu) build.prop file.

Go to your sd card and copy build.prop modified file.
Past it in system folder.

Touch build.prop long time and set Permissions to rw-r--r-- (0644) :
READ -> Owner -> checked
READ -> Group -> checked
READ -> Others -> checked
WRITE -> Owner -> checked
And lets all others entry unchecked and click OK.

Reboot. That's all.

  • Thanks. Even though its being long after the answer has come up, The question itself tells that this has been tried in a code level and it explains the result and issues. Please check back. Commented Apr 12, 2016 at 9:41

There's an App called "App Settings" for Xposed Framework. repo.xposed/appsettings

With it you can change orientation, dpi, notifications, etc. of each individual app. But not the boot animation like samnaction explained.

Alternatively, i found this on stackoverflow: changing-android-device-orientation-with-adb
So you could make a script like this

content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0

and put it in /etc/init.d for executing at boot
(if you're on stock, you have to mod your rom to have init.d.)

edit:works just on Android 4.3+

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .