Skip to content

Android Screen Rotation

Note

All Rockchip series development boards support the customization operations described in this chapter. For Allwinner series boards, all models except the K4B support the operations in this chapter.

Dynamic Screen Orientation Configuration

Android supports using ADB commands to rotate the screen. This rotation is temporary and will be lost 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 set the screen orientation of an Android device, and this set 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 Screen Orientation Modification in Source Code

Modify the default display orientation in the Android SDK.

A133 source code file path:

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

H618 source code file path:

device/softwinner/apollo/apollo_p2.mk

A733 source code file path:

Note

In the A733 source code, this configuration is located in device-common.mk, Modify the ro.surface_flinger.primary_display_orientation property.

device/softwinner/jupiter/a733-demo-aiot/device-common.mk

T527 source code file path:

device/softwinner/saturn/t527-demo/device-common.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 \
+   ro.surface_flinger.primary_display_orientation=ORIENTATION_90 \