androidandroid-8.1-oreo

Screen orientation portrait for nano pc t4 board under Android 8.1


We have issue with screen orientation for the nano pc t4 board running Android 8.1. On Landscape mode it works correctly, but in portrait mode it scales and shows as in the picture below with black corners:

Photo of TV. Screen orientation is horizontal but Android app displayed vertically

Currently we need to flip that as shown in the picture below with no black spaces:

Photo of monitor with orientation rotated 90 degrees. App is displayed properly

We have tested in multiple ways:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);

and more variants. Can anyone help to set right configuration?


Solution

  • the HDMI output can be rotated, after unlocking the rotation lock:

    adb shell root
    adb shell remount
    adb shell setprop persist.demo.hdmirotation portrait
    adb shell setprop persist.demo.hdmirotationlock false
    adb shell setprop persist.demo.singledisplay true
    adb reboot
    

    one can then set the wm's display geometry:

    adb shell wm size 1080x1920
    adb shell wm size 1920x1920
    

    or switch the user_rotation:

    settings put system user_rotation 1
    settings put system user_rotation 3
    

    the NXP community seems to be the source.