Display Rotation in Android

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Display Rotation in Android

9,715件の閲覧回数
teddy123
Contributor III


Hi All,

We have interfaced a custom LVDS board which comes with a portrait panel with our sabresd board. Currently we rotated the display buffer by 270 degree in the clock wise direction using SurfaceFlinger to suit our need. This is done using the following System Property, "ro.sf.hwrotation" .

But under some cases[ex. connecting USB Keyboard], display gets switched between landscape and portrait for a moment and returns back to expected position.  This doesnot happen when rotation is not performed. Is there any way to perform this rotation in driver itself?

Regards,

John

ラベル(5)
タグ(2)
0 件の賞賛
返信
16 返答(返信)

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi,

I confirm the same issue here running the latest Android 5.1.1-2.1.0-GA on a Nitrogen6x.

It is actually weird, because plugging a USB drive doesn't affect the display but plugging a USB keyboard makes the display go back to landscape.

Any insight?

Regards,

Gary

0 件の賞賛
返信

7,067件の閲覧回数
gary_bisson
Senior Contributor III

Hi,

Quick update, it seems to come from the InputReader.

Looking at it, I realized one patch was missing to manage display rotation since InputReader.cpp changed from frameworks/base to frameworks/native. This is the cause of another issue where the touchscreen coordinates are not processed properly due to the rotation:

InputReader: add screen rotation management · boundarydevices/frameworks_native@e769b6c · GitHub

However the issue where the view switches to landscape when an external keyboard is plugged in still exists.

Please advise.

Regards,

Gary

0 件の賞賛
返信

7,067件の閲覧回数
gary_bisson
Senior Contributor III

Hi,

Has anyone from the NXP Android team been able to reproduce and track down the issue? This is a serious problem for customers that want to use the Android release in portrait mode.

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi Gary,

Let me try to reproduce the problem on my side. But I lack of the board and BSP you are using. I will see if the problem exists in the SABRE-SD board. I will get back to you as soon as possible.

Best Regards,

Alejandro

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi Alejandro,

Sorry to insist but do you have any update. This is an important issue which I hope you've been able to reproduce.

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
gusarambula
NXP TechSupport
NXP TechSupport

Hello Gary Bisson,

Alejandro has been trying to reproduce but he's away until Monday. He will contact you as soon as he gets back to give you an update on this matter.

Thank you for your patience!

Regards,

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi,

Thanks for the update. Hopefully he has been able to reproduce the issue easily.

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi Gary,

Sorry for the long delay but I have had problems trying to reproduce the problem, for some reason every time I try to change the .rc file the boot process just hangs, I am still working on this.

Best Regards,

Alejandro

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi Alejandro,

Where in the boot process do you get stuck? Let me know if you need help generating a boot.img. I suggest you take the release boot.img, unpack it, extract the initramfs, modify the init.freescale.rc and repack everything.

As a FYI, I've changed ro.sf.hwrotation directly in the board init.rc, in your case under device/fsl/sabresd_6dq/init.rc.

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi Gary,

Sorry for the long delay. I was just able to reproduce the problem in the sabre-ai board. The problem even shows when you send the board to sleep mode. I will delve into this and I will get back to you as soon as I have something useful.

Best Regards,

Alejandro

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi Alejandro,

Good news, thanks for letting me know. I've seen the m6.0.1_1.0.0-ga kernel tag appearing which means the release is on its way, hopefully the bug won't be there.

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I tested it with M6.0.1 and the behavior remains.

I got help from the experts. Below you can find their information:

I think it's not an issue. Android designs it during freezing screen. We can set the following flag to disable rotation but Android still needs time to freeze screen. The rotation animation is replaced with black screen.

diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java

index d308f14..a835879 100644

--- a/services/core/java/com/android/server/wm/WindowManagerService.java

+++ b/services/core/java/com/android/server/wm/WindowManagerService.java

@@ -268,7 +268,7 @@ public class WindowManagerService extends IWindowManager.Stub

      * If true, the window manager will do its own custom freezing and general

      * management of the screen during rotation.

      */

-    static final boolean CUSTOM_SCREEN_ROTATION = true;

+    static final boolean CUSTOM_SCREEN_ROTATION = false;

     // Maximum number of milliseconds to wait for input devices to be enumerated before

     // proceding with safe mode detection.

Customer can change the rotation animation according to their need. Please look up startFreezingDisplayLocked() in WindowManagerService.java.

Regards,

Alejandro

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi Alejandro,

Sorry but I disagree with the experts statement that "it's not an issue". It is, and the patch above doesn't fix it, it just hides it a little.

Indeed it produces a black screen instead of showing an animation, but the real question was:

Why is a screen rotation/animation triggered when plugging an HID device?

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi,

According to the experts and below loh it's Android designed behavior. You can add call stack into ScreenRotationAnimation to watch the whole flow as the below dump from Android LP5.1.1_2.1.0-GA.

               Add "Slog.w(TAG,"callstack", new Throwable());" into ScreenRotationAnimation.java

W/ScreenRotationAnimation(  485):      at com.android.server.wm.ScreenRotationAnimation.<init>(ScreenRotationAnimation.java:291)

W/ScreenRotationAnimation(  485):      at com.android.server.wm.WindowManagerService.startFreezingDisplayLocked(WindowManagerService.java:10621)

W/ScreenRotationAnimation(  485):      at com.android.server.wm.WindowManagerService.startAppFreezingScreenLocked(WindowManagerService.java:4712)

W/ScreenRotationAnimation(  485):      at com.android.server.wm.WindowManagerService.startAppFreezingScreen(WindowManagerService.java:4744)

W/ScreenRotationAnimation(  485):      at com.android.server.am.ActivityRecord.startFreezingScreenLocked(ActivityRecord.java:850)

W/ScreenRotationAnimation(  485):      at com.android.server.am.ActivityStack.ensureActivityConfigurationLocked(ActivityStack.java:3682)

W/ScreenRotationAnimation(  485):      at com.android.server.am.ActivityManagerService.updateConfigurationLocked(ActivityManagerService.java:16770)

W/ScreenRotationAnimation(  485):      at com.android.server.am.ActivityManagerService.updateConfiguration(ActivityManagerService.java:16661)

W/ScreenRotationAnimation(  485):      at com.android.server.wm.WindowManagerService.sendNewConfiguration(WindowManagerService.java:7053)

W/ScreenRotationAnimation(  485):      at com.android.server.wm.InputMonitor.notifyConfigurationChanged(InputMonitor.java:331)

W/ScreenRotationAnimation(  485):      at com.android.server.input.InputManagerService.notifyConfigurationChanged(InputManagerService.java:1385)

Best Regards,

Alejandro

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi Alejandro,

Any update on this issue? Have you been able to reproduce?

Regards,

Gary

0 件の賞賛
返信

7,068件の閲覧回数
gary_bisson
Senior Contributor III

Hi Alejandro,

Thanks for looking into this. Teddy, who asked the question first, is using a SABRE-SD so I'm sure the problem exists with this platform too. Also note that I've tried to set ro.sf.hwrotation to 90 and 270, in both cases the result is the same.

Regards,

Gary

0 件の賞賛
返信