Hi Dave,

Please refer below steps to force orientation to landscape:

1. Make sure only landscape permission is available on your build environment

Only add android.hardware.screen.landscape.xml to your makefile by below 
command:

PRODUCT_COPY_FILES += 
frameworks/native/data/etc/android.hardware.screen.landscape.xml:system/etc/permissions/android.hardware.screen.landscape.xml
 \

Remove android.hardware.screen.portrait.xml if it exists

2. Add an overlay to force landscape mode
Assume you have device/company/device_x

Create a config.xml file and put it in

device/company/device_x/overlay/framework/base/res/res/values

Contents of config.xml:

<resources>
      <bool name="config_forceDefaultOrientation">true</bool>
</resources>

3. Make sure your overlay in config.xml is used

PRODUCT_PACKAGE_OVERLAYS += device/company/device_x/overlay

Done! Your system is always landscape!

Note: This solution only works on Android P or older Android version. From 
Android Q, Google changes to use new solution.

Limitation: The app which sets portrait as orientation in AndroidManifest.xml 
can’t display properly! Ex: Antutu Benmark.

By the way, I had found solution for above limitation by creating a broadcast 
service which tried to convert rotation of the application. But i just forgot 
the reference. I will try to find it and share you later!

Best Regards,
KHA Tran




-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/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 android-porting+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-porting/0c74c118-fa37-43cb-bfeb-fc3fd15dd2a3o%40googlegroups.com.

Reply via email to