On Android head units, the orientation typically defaults to landscape. And has disabled auto-rotation, the screen will always remain in a landscape mode. This effectively means you can't use any software on Google Play Store or other places to change this default because auto-rotation is disabled. I need to change this feature to portrait for custom firmware I have placed on my head unit (using Android 10). I have installed Magisk.

In my attempts to work out how to do this, I have gathered some information, but I have not got enough experience or knowledge to know how to do this. I really need guidance.

I believe in order to do this correctly, this needs to be done at root, and place in one of these locations in Magisk

(1) /sbin/.magisk/.core/post-fs-data.d/


(2) /data/adb/service.d/

and the command syntax would look something like this (3)

adb shell settings put system accelerometer_rotation 0 # auto-rotation, 0 disable, 1 enable
adb shell settings put system user_rotation 0 # actual-rotation, clockwise, options 0[0°], 1[90°],2[180°],3[270°]

Source:- https://stackoverflow.com/questions/25864385/changing-android-device-orientation-with-adb

or (4)

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

or (5)

import android.provider.Settings;

// You can get ContentResolver from the Context
Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0);
Settings.System.putInt(getContentResolver(), Settings.System.USER_ROTATION, 0);

or something else (Other source documents)

How to change Android default-natural orientation?

Thank you for any time you invest in this.


You must log in to answer this question.

Browse other questions tagged .