How do you set the default display orientation in Android 7 aosp?

1,797 views
Skip to first unread message

Nirmit Shah

unread,
Dec 11, 2017, 3:59:22 PM12/11/17
to android-porting

There used to be  "ro.sf.hwrotation" property in the previous android to set the default natural display orientation. Can anyone tell me the correct way to set the default display orientation, currently it defaults to portrait but I want it to be in landscape mode? Is there a support doc for this?

satur9nine

unread,
May 12, 2018, 10:41:40 AM5/12/18
to android-porting
Same question here.

satur9nine

unread,
Jun 2, 2018, 11:53:05 PM6/2/18
to android-porting
I did some research.

In the past there was ro.sf.hwrotation, but Google removed this property. However, some people have resurrected it. LineageOS is pretty trustworthy. Search their code for uses of this property in github project https://github.com/LineageOS/android_frameworks_native. Here are a couple commits you will find:

https://github.com/LineageOS/android_frameworks_native/commit/a9fa1c9c19d6ac00aa0073ef23b7a1d95f8e0a90

https://github.com/LineageOS/android_frameworks_native/commit/8c36832b66e9ae793cf79820d83628d136bfd117

Maybe someone at Google would kindly explain why we can't have this in AOSP?

Jaymin D

unread,
Aug 23, 2018, 11:28:02 AM8/23/18
to android-porting
Hi,

I have set the default orientation to LANDSCAPE in my Android AOSP 7, by changing in file - "packages/apps/Launcher3/src/com/android/launcher3/Launcher.java" as below:

             setRequestedOrientation(
-                    ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
+     ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Try this, may this will help you. It changes my display orientation to landscape mode, the only thing is lock screen will not rotate. 

Regards,
Reply all
Reply to author
Forward
0 new messages