I have a general purpose Android computer that has no sensors. It requires an external monitor to view output via HDMI. It always displays in landscape unless the app running specifies portrait.

1) The screen PHYSICALLY needs to be displayed in portrait.
2) The OS always displays in landscape, unless an app overrides orientation.

3) How to change the default (currently landscape) orientation to portrait in the OS?

Is there a setting in Android that determines default orientation or does this require a hack? I have root access.

  • 1
    So you want the screen orientation to stay in landscape mode even if an app calls for it to switch to portrait mode? – New-To-IT Feb 18 '15 at 15:37
  • 1
    @New-To-IT The screen is in landscape, always. I need it to display in portrait. Please see my edits. – Roy Hinkley Feb 18 '15 at 15:46
  • So to put in in easy terms: You've got some 70 inch flatscreen fixed to the wall in landscape so it cannot be turned, and don't want to tilt your head 90° if an app choses portrait – correct? – Izzy Feb 18 '15 at 16:12
  • 1
    @Izzy No - please see my edits. Sorry I am not making this clear! – Roy Hinkley Feb 18 '15 at 16:19
  • Sometimes that's the hardest part, so don't worry. That's what comments are for, amongst others: to clarify open points. So let's go for an answer – in the hope I've got it right now ;) – Izzy Feb 18 '15 at 16:24

Run this from adb shell or from a root terminal:

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

Change the value to 1 if you want to go back to Landscape (2 and 3 also work for upside-down portrait and reverse landscape).

  • 1
    Confirmed to work, but does not require root (at least on Lollipop). Make sure the app supports portrait mode and remember to disable automatic screen orientation. – GiantTree Feb 18 '15 at 17:32
  • @GiantTree I've clarified; Terminal Emulator on my device requires root because it does not request ACCESS_CONTENT_PROVIDERS_EXTERNALLY. – Matthew Read Feb 18 '15 at 17:47
  • ADB has extensive permissions because of the context it is running in (userid 2000). It can be treated like a system app with just debugging permissions (like ACCESS_CONTENT_PROVIDERS_EXTERNALLY). – GiantTree Feb 18 '15 at 17:51

There's an app called Set Orientation which looks like it does what you need:

Set Orientation allows you to force your device into a particular screen orientation.

Set Orientation Set Orientation
Screenshots of Set Orientation (source: Google Play; click images for larger variants)

As the screenshots show, this app let's you override the sensors (which you don't have) and tell the system which way your screen is oriented.

Update: the app was unlisted from Play, but you can find some alternatives here.

  • That's an interesting option, but no third party apps are allowed in the environment. This is going into an industrial application. – Roy Hinkley Feb 18 '15 at 17:01
  • Sorry for that. But maybe you could get in contact with the dev to see if there's another way to trigger that? – Izzy Feb 19 '15 at 10:24
  • How does this app work? Looking at the permissions, it has permission to draw on top. – android developer Oct 15 '16 at 8:02
  • @androiddeveloper I have no idea about the underlying functionality, never used the app myself – so sorry, I cannot detail on that. Neither do I know what for it might need the "draw on top" permission. Though the screenshots give a clue: What you see in background is the launcher, but in foreground are the dialogs of the app. So apparently it draws its dialogs "on top" of whatever app is running. – Izzy Oct 15 '16 at 16:18
  • @Izzy The dialog can simply have a transparent background around it. Disabling this permission still shows the dialog, and yet the app doesn't really do its job. I suspect they show an on top UI with just one transparent pixel "seen" (so that it won't be noticed), and do something about the orientation. – android developer Oct 15 '16 at 19:42

Android 6+ you just check Auto Orientation. Select desired Orientation. Check Lock Screen. Deselect Auto orientation. Close reboot to check.

  • I tried this on two devices and was unable to make it work (both on 7.X). If this is a device specific answer, please include your make/model of device. – acejavelin Oct 19 '17 at 21:51

In settings -> accessibility -> autorotate screen there is an option that is stronger than the display options !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.