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.
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!
-----------------------------------------------------------------------------------------------------------------------
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.