How to make android system display vertically(rotate 270 degree) at startup

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make android system display vertically(rotate 270 degree) at startup

691 Views
edward_fu
Contributor III

Hi experts,

I need my imx8mq board android system display vertically at startup.  Do you have any suggestions?

I tried as below:

I can set "settings put system user_rotation 3" manully by adb. And it can rotate 270 degree.

But I need display vertically at startup not manually.

So I added a service in /vendor/etc/init/hw/init.nxp.rc

service rotate-screen /vendor/bin/rotate-screen.sh
    class main
    user root
    group root system
    disabled
    oneshot

on post-fs-data
    start rotate-screen

And contents in rotate-screen.sh is:

settings put system user_rotation 3

But it does now work. it seems the rotate-screen.sh not executed.

 

Thanks

0 Kudos
8 Replies

682 Views
Qmiller
NXP Employee
NXP Employee

Try to change /device/nxp/xxx/build.prop

 

ro.sf.hwrotation = 180/270/90

 

0 Kudos

677 Views
edward_fu
Contributor III

There is no build.prop file in imx-android-11.0.0_2.0.0/android_build/device/nxp and recursive folder.

 

Actually I had tried to add blew contents in imx-android-11.0.0_2.0.0/android_build/device/nxp/imx8m/evk_8mq/init.rc before

on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
     setprop ro.sf.hwrotation 270

But it did not work.

0 Kudos

672 Views
Qmiller
NXP Employee
NXP Employee

You can see this part of patch about compositor to support sufaceflinger rotation

project vendor/nxp-opensource/imx/
diff --git a/display/display/Composer.cpp b/display/display/Composer.cpp

0 Kudos

663 Views
edward_fu
Contributor III

Thanks for your reply.

You mean just modifying the  vendor/nxp-opensource/imx/display/display/Composer.cpp to support sufaceflinger rotation?

0 Kudos

655 Views
Qmiller
NXP Employee
NXP Employee

Yes,and the go file.

0 Kudos

630 Views
edward_fu
Contributor III

Do you have any update?

0 Kudos

643 Views
edward_fu
Contributor III

I followed your suggestions and did like below:

1. add 

BOARD_HAVE_VPU \
+SF_PRIMARY_DISPLAY_ORIENTATION

+SOONG_CONFIG_IMXPLUGIN_SF_PRIMARY_DISPLAY_ORIENTATION = 270
SOONG_CONFIG_IMXPLUGIN_BOARD_PLATFORM = imx8

in device/nxp/imx8m/BoardConfigCommon.mk

2. add 

+SF_PRIMARY_DISPLAY_ORIENTATION := 270
BOARD_PREBUILT_DTBOIMAGE := $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/dtbo-imx8mq.img

in device/nxp/imx8m/evk_8mq/BoardConfig.mk

3. modified vendor/nxp-opensource/imx/display/display/Composer.cpp and vendor/nxp-opensource/imx/display/display/display.go file as you said.

But it still did not work.

And I dig the log, at least the log of below 

ALOGV("index:%d, i:%d sourceCrop(l:%d,t:%d,r:%d,b:%d), "
"visible(l:%d,t:%d,r:%d,b:%d), "
"display(l:%d,t:%d,r:%d,b:%d)", layer->index, (int)i,
srect.left, srect.top, srect.right, srect.bottom,
clip.left, clip.top, clip.right, clip.bottom,
drect.left, drect.top, drect.right, drect.bottom);

did not apper.

0 Kudos

651 Views
edward_fu
Contributor III

Thanks, I will try right row.

0 Kudos