How to set display to default portrait mode in JB4.2?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set display to default portrait mode in JB4.2?

6,076 Views
yifeiwang
Contributor III

I've imx6q dev board and running jb4.2 android, I'd like to know how to set display to default portrait mode?

I've already set "setprop ro.sf.hwrotation 270", however no effect.

Labels (2)
0 Kudos
Reply
5 Replies

1,892 Views
ninadmalwade
Contributor I

Hi YiFei,


The ro.sf.hwrotation is not available under iMX.6 4.2.2 BSP.

However, I have added a patch for the same for our custom device. Hope it will help you.

My primary usage was to get the device rotated in 270 and this patch may not work for 90. So, you may need to tweak a little in WindowManagerService.java.

Note:

1. Make sure that you set the ro.sf.hwrotation in init.rc and build the image.

2. This is still not the full-fledged hwrotation support becasue I still cannot get the rotated bootanimation. For that I may need to tweak the surfaceflinger.

Please see the below patch for details:

------------------------------------------------------------

Index: base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

===================================================================

--- base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java (revision 4346)

+++ base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java (revision 4554)

@@ -4027,7 +4027,15 @@

             } else {

                 // No overriding preference.

                 // We will do exactly what the application asked us to do.

-                preferredRotation = -1;

+ if ((SystemProperties.getInt("ro.sf.hwrotation", 0) == 270 ||

+ SystemProperties.getInt("ro.sf.hwrotation", 0) == 90)){

+

+ //Overrriding any preferred orientations as per the device settings

+ //Set preferred orientation as portrait unless application wants to override it

+ preferredRotation = mPortraitRotation;

+ } else {

+                 preferredRotation = -1;

+ }

             }

             switch (orientation) {

Index: base/services/java/com/android/server/wm/WindowManagerService.java

===================================================================

--- base/services/java/com/android/server/wm/WindowManagerService.java (revision 4346)

+++ base/services/java/com/android/server/wm/WindowManagerService.java (revision 4554)

@@ -818,6 +818,12 @@

         mActivityManager = ActivityManagerNative.getDefault();

         mBatteryStats = BatteryStatsService.getService();

+ // Change the default boot time orientation as per device settings

+ if ((SystemProperties.getInt("ro.sf.hwrotation", 0) == 270 ||

+ SystemProperties.getInt("ro.sf.hwrotation", 0) == 90)) {

+ mRotation = 3;

+ }

+

         // Get persisted window scale setting

         mWindowAnimationScale = Settings.Global.getFloat(context.getContentResolver(),

                 Settings.Global.WINDOW_ANIMATION_SCALE, mWindowAnimationScale);

-----------------------------------------------------------------------

Thanks,

-Ninad.

0 Kudos
Reply

1,892 Views
jamesbone
NXP TechSupport
NXP TechSupport

Which i.MX6 board do you have?  what exact version are you using of the Android BSP is a FSL official web sited? I already try it and it is working on the i.MX6SABRE SDP board.  Maybe this can also help you.

Re: Android portrait mode and rotation


Have a great day,
Jaime

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,892 Views
yifeiwang
Contributor III

I have official i.MX6SABRE SDP board, and I modified init.freescale.rc file under /dev/sdb1 partition inside your official SD card coming with your board(unpack & repack boot.img), no any effect. I checked "About tablet" inside android, it states Android version as 4.2.2.

I'd like to know what & how you modified, so you saw both start-up logo and home screen in portraint mode, thanks a lot.

0 Kudos
Reply

1,892 Views
jamesbone
NXP TechSupport
NXP TechSupport
0 Kudos
Reply

1,892 Views
yifeiwang
Contributor III

How is this one related to Android JB4.2.2? Can you elaborate how you follow that one and apply to Android? thanks.

0 Kudos
Reply