Jump to content
Electronics-Lab.com Community

Recommended Posts

Posted

The default display orientation for the Android interface on the Forlinx Embedded i.MX8MP platform is landscape, but some products may require a portrait display. To address this requirement, Forlinx Embedded provides the following methods for modification:

The Android system controls the screen orientation through the persist.vendor.orientation property, which can have values of 0, 90, 180, or 270.

Configuration path: frameworks/native/services/su**ceflinger/Su**ceFlinger.cpp

Modify in processDisplayHotplugEventsLocked:

Su**ceFlinger::processDisplayHotplugEventsLocked() {
             continue;
         } 
+       /* Rotate desktop */
+       char rotationvalue[PROPERTY_VALUE_MAX] = "";;
+       property_get("persist.vendor.orientation", rotationvalue, "-1");
+       int rotation = atoi(rotationvalue);
+       ALOGI("Primary Display Orientation is set to rotation %2d.", rotation);
+       switch (rotation) {
+               case 0:
+                         internalDisplayOrientation = ui::ROTATION_0;
+                       break;
+               case 90:
+                       internalDisplayOrientation = ui::ROTATION_90;
+                       break;
+               case 180:
+                       internalDisplayOrientation = ui::ROTATION_180;
+                       break;
+               case 270:
+                       internalDisplayOrientation = ui::ROTATION_270;
+                       break;
+               default:
+                       break;
+       }
+ const DisplayId displayId = info->id;
         const auto it = mPhysicalDisplayTokens.find(displayId);

 

After modification, you need to add the relevant configuration in the environment variable.

Path: device/nxp/imx8m/evk_8mp/system.prop

persist.sys.timezone=Asia/Shanghai
persist.sys.language=zh
persist.sys.country=CN 
+persist.vendor.orientation=90

 

Rotate 90 degrees here to write 90, 180 degrees to write 180, 270 degrees to write 270.

If you encounter a failure to set the value of a property:

Add the followings in device/nxp/imx8m/sepolicy/property_contexts;

+persist.vendor.orientation    u:object_r:debug_prop:s0
vendor.wc_transport.        u:object_r:vendor_wc_prop:s0
persist.vendor.usb.config     u:object_r:vendor_usb_config_prop:s0
vendor.usb.config         u:object_r:vendor_usb_config_prop:s0

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...