androidadbscreen-orientation

Rotate Android display without changing orientation


Essentially what I am trying to complete is having a rectangle monitor sideways (vertical orientation) with the Android display in the Portrait position. Due to limitation of the monitor though it is not viable to rotate the display on the monitor itself. First I set disable the auto rotation and then set it to portrait mode.

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

I then try to change the resolution to 1920x1080 using the following command

adb shell wm size 1920x1080

This then throws display back into landscape mode. I would prefer to complete this through adb or any method that would not require additional software.

EDIT:

To clarify I want to emulate the CTRL+ALT+RIGHT ARROW on Windows computer but on an android device preferably through ADB, or any other method besides 3rd party applications.

Photos demonstrating incorrect orientations and a photoshopped correct one


Solution

  • I was able to find a relevant answer after some more digging.

    Some of this may not be needed but this is what I did to acheive the desired effect. There was also a glitch where Android would not update the rotation so after restarting you have to change the rotation to something else and then back to the original.

    adb shell root
    adb shell remount
    adb shell setprop persist.demo.hdmirotation portrait
    adb shell setprop persist.demo.hdmirotationlock false
    adb shell setprop persist.demo.singledisplay true
    adb reboot
    adb shell wm size 1080x1920
    adb shell wm size 1920x1920
    

    The answer was found here, and the relevant documentation was found here.