Skip to content

Android Screen Rotation

Dynamic Screen Orientation Configuration

Android supports using ADB commands to rotate the screen. This rotation is temporary and will be reset after a reboot.

// 0 degrees
adb shell settings put system user_rotation 0

// 90°
adb shell settings put system user_rotation 1

// 180°
adb shell settings put system user_rotation 2

// 270°
adb shell settings put system user_rotation 3

Disable Automatic Rotation

adb shell settings put system accelerometer_rotation 0

Permanently set the screen orientation

Using ADB commands, you can permanently configure the screen orientation of an Android device, and this configuration will take effect after the device is restarted.

// 0
adb shell setprop persist.surface_flinger.primary_display_orientation ORIENTATION_0
// 90°
adb shell setprop persist.surface_flinger.primary_display_orientation ORIENTATION_90
// 180°
adb shell setprop persist.surface_flinger.primary_display_orientation ORIENTATION_180
// 270°
adb shell setprop persist.surface_flinger.primary_display_orientation ORIENTATION_270

Reboot Command.

adb reboot

Rockchip Default Display Orientation Configuration

Note

$(dev) should be selected based on SoC:
K1/K1B: rk356x
K3: rk3562
K8: rk3588
K7/K7C: rk3576

(SDK)$ vim device/rockchip/$(dev)/BoardConfig.mk
(SDK)$ vim device/rockchip/rk356x/BoardConfig.mk // For K1

    SF_PRIMARY_DISPLAY_ORIENTATION := 0     //0°
    SF_PRIMARY_DISPLAY_ORIENTATION := 90    //90°
    SF_PRIMARY_DISPLAY_ORIENTATION := 180   //180°
    SF_PRIMARY_DISPLAY_ORIENTATION := 270   //270°

AllWinner Source Code Screen Orientation Modification

Modify the default display orientation in the Android system.

A133 source code file path:

android/device/softwinner/ceres-c3/ceres_c3.mk

H618 source code file path:

device/softwinner/apollo/apollo_p2.mk

Example: Modify the default screen display to rotate 90°.

Tip

Supports ORIENTATION_0, ORIENTATION_90, ORIENTATION_180, ORIENTATION_270.

PRODUCT_PROPERTY_OVERRIDES += \
-    ro.surface_flinger.primary_display_orientation=ORIENTATION_0
    #feisi 
-    #ro.surface_flinger.primary_display_orientation=ORIENTATION_90
+   ro.surface_flinger.primary_display_orientation=ORIENTATION_90
    #ro.surface_flinger.primary_display_orientation=ORIENTATION_270