Configure display orientation to reverse landscape

Hi,

I am running a custom build of Android N and connecting an external monitor via HDMI port and trying to get the orientation of the display rotated in reverse/flipped landscape or reverse portrait mode and it appears that flipped orientations are getting ignored.
The display only rotates in Landscape and Portrait modes, and it would not accept Reverse Landscape or Reverse Portrait.
I checked in Linux and Windows that I can rotate the desktop to double check it’s not the monitor and tried different monitors as well

Here is the list of things that I’ve tried on the software side:

  1. Add
ro.sf.hwrotation=0/90/180/270

to /system/build.prop and reboot the device
2. Install display rotation app and try rotating that way. Portrait and landscape work fine, but not reverse mode
3. Disable accelerometer rotation via ADB

adb shell settings put system accelerometer_rotation 0
  1. Rotate via ADB
adb shell settings put system user_rotation 0/1/2/3

In Android source code I modified the following

  1. frameworks/base/core/res/res/values/config.xml and configured
    “config_undockedHdmiRotation” and “config_undockedPrimaryHdmiRotation” to 0/90/180/270. It appears that 0 and 180 are landscape modes (regular and reverse respectively), and 90 and 270 are for portrait.
    “config_enableLockScreenRotation” = “true”

  2. frameworks/base/packages/SettingsProvider/res/values/defaults.xml “def_accelerometer_rotation” = “false” because I’m not using that; “def_user_rotation” = 0/1/2/3 (tried each combination)

  3. device/customVendor/customModel/overlays/customSub/frameworks/base/core/res/res/values/config.xml and configured “config_undockedHdmiRotation” and “config_undockedPrimaryHdmiRotation” to 0/90/180/270, and “config_forceDefaultOrientation” = “false”

  4. packages/apps/Launcher3/res/values/config.xml “allow_rotation” = “true” This is for launcher app that I’m currently using and it used to be set to “false”

When the Android boots, I can see the screen rotating to reverse landscape and then it switches back immediately to regular landscape, so it appears that some setting is overriding the orientation.

I would really appreciate some help because I think I’m out of ideas and combinations of settings that I can try

Thanks,
-Georgiy

It switches back to original orientation most likely because of rotation lock.

setprop persist.demo.rotationlock 0 → To unlock rotation
settings put system user_rotation → Change orientation (0/1/2/3)
setprop persist.demo.rotationlock 1 → Lock the rotation again

Would this work for the the Shield TV Pro?

Hi there @jack117 and welcome to the NVIDIA developer forums.

As much as an answer on our forums is appreciated, 4 years is a very long time, so the overll situation has probably changed by now and your answer would not be applicable any longer.

But more importantly your post looks a lot like what Chat-GPT might give us as a suggestion, and I would kindly ask to refrain from using chat bots to answer on this forum unless it is clearly marked as such.

Thanks!