From 2ad63a9d773ba987e85ee6a23b0a0724d86d4b0e Mon Sep 17 00:00:00 2001 From: Chris Tate <> Date: Wed, 25 Mar 2009 17:36:48 -0700 Subject: [PATCH] Automated import from //branches/donutburger/...@142784,142784 --- .../com/android/server/WindowManagerService.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index ed8b23af35520..19ab21d822c40 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -8551,6 +8551,15 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo private void startFreezingDisplayLocked() { if (mDisplayFrozen) { + // Freezing the display also suspends key event delivery, to + // keep events from going astray while the display is reconfigured. + // If someone has changed orientation again while the screen is + // still frozen, the events will continue to be blocked while the + // successive orientation change is processed. To prevent spurious + // ANRs, we reset the event dispatch timeout in this case. + synchronized (mKeyWaiter) { + mKeyWaiter.mWasFrozen = true; + } return; } @@ -8594,10 +8603,8 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo } Surface.unfreezeDisplay(0); - // Freezing the display also suspends key event delivery, to - // keep events from going astray while the display is reconfigured. - // Now that we're back, notify the key waiter that we're alive - // again and it should restart its timeouts. + // Reset the key delivery timeout on unfreeze, too. We force a wakeup here + // too because regular key delivery processing should resume immediately. synchronized (mKeyWaiter) { mKeyWaiter.mWasFrozen = true; mKeyWaiter.notifyAll();