From bdd52b264af8f562dd368d40b66771c88d45127f Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 2 Sep 2009 21:46:19 -0700 Subject: [PATCH] Fix issue #2097060: Screen all messed up when setup wizard finished The new code to rebuild the window list was missing some app tokens. Also there were a few other smaller bugs floating around. Change-Id: I7734917af0b76ee4aa304e6a5321401d87640f89 --- .../android/server/WindowManagerService.java | 72 +++++++++++-------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index c7c748f5ac409..1ea1b3193c2fa 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -135,6 +135,7 @@ public class WindowManagerService extends IWindowManager.Stub static final boolean DEBUG_INPUT = false; static final boolean DEBUG_INPUT_METHOD = false; static final boolean DEBUG_VISIBILITY = false; + static final boolean DEBUG_WINDOW_MOVEMENT = false; static final boolean DEBUG_ORIENTATION = false; static final boolean DEBUG_APP_TRANSITIONS = false; static final boolean DEBUG_STARTING_WINDOW = false; @@ -1903,6 +1904,12 @@ public class WindowManagerService extends IWindowManager.Stub moveInputMethodWindowsIfNeededLocked(false); } + if (false) { + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "Removing window " + win, e); + } + mPolicy.removeWindowLw(win); win.removeLocked(); @@ -2716,10 +2723,10 @@ public class WindowManagerService extends IWindowManager.Stub Configuration config; synchronized(mWindowMap) { config = updateOrientationFromAppTokensLocked(currentConfig, freezeThisOneIfNeeded); - } - if (config != null) { - mLayoutNeeded = true; - performLayoutAndPlaceSurfacesLocked(); + if (config != null) { + mLayoutNeeded = true; + performLayoutAndPlaceSurfacesLocked(); + } } return config; } @@ -3412,11 +3419,15 @@ public class WindowManagerService extends IWindowManager.Stub final int NW = token.windows.size(); for (int i=0; i 0) { j--; - mWindows.remove(win.mChildWindows.get(j)); + WindowState cwin = (WindowState)win.mChildWindows.get(j); + if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, + "Tmp removing child window " + cwin); + mWindows.remove(cwin); } } return NW > 0; @@ -3497,14 +3508,20 @@ public class WindowManagerService extends IWindowManager.Stub for (int j=0; j= 0) { + if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Re-adding child window at " + + index + ": " + cwin); mWindows.add(index, win); index++; added = true; } + if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Re-adding window at " + + index + ": " + cwin); mWindows.add(index, cwin); index++; } if (!added) { + if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Re-adding window at " + + index + ": " + win); mWindows.add(index, win); index++; } @@ -8516,39 +8533,29 @@ public class WindowManagerService extends IWindowManager.Stub i=0; while (i < NW) { if (((WindowState)mWindows.get(i)).mAppToken != null) { - mWindows.remove(i); + WindowState win = (WindowState)mWindows.remove(i); + if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, + "Rebuild removing window: " + win); NW--; continue; } i++; } - // Now go through the app tokens and add the windows back in. - int NT = mAppTokens.size(); + // First add all of the exiting app tokens... these are no longer + // in the main app list, but still have windows shown. We put them + // in the back because now that the animation is over we no longer + // will care about them. + int NT = mExitingAppTokens.size(); i = 0; for (int j=0; j= 0) { - break; - } - mWindows.add(i, cwin); - i++; - } - mWindows.add(i, win); - i++; - for (; c=0; i--) { WindowState w = (WindowState)mWindows.get(i); @@ -9100,6 +9108,8 @@ public class WindowManagerService extends IWindowManager.Stub boolean syswin = false; boolean backgroundFillerShown = false; + final int N = mWindows.size(); + for (i=N-1; i>=0; i--) { WindowState w = (WindowState)mWindows.get(i);