Skip to content

Commit cb882f9

Browse files
author
Jeff Brown
committed
Fix bug removing all windows that belong to a display.
Removing one window causes its subwindows to also be removed. We have to be careful when traversing the window list because multiple windows may be removed at a time so we don't get IndexOutOfBoundsException due to the window list changing in unexpected ways. Bug: 7273702 Change-Id: I0ed9ba00c325ad178ab28919ce2e763cb6fd38ba
1 parent c272664 commit cb882f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10870,8 +10870,8 @@ private void handleDisplayRemovedLocked(int displayId) {
1087010870
final DisplayContent displayContent = getDisplayContentLocked(displayId);
1087110871
mDisplayContents.delete(displayId);
1087210872
WindowList windows = displayContent.getWindowList();
10873-
for (int i = windows.size() - 1; i >= 0; --i) {
10874-
final WindowState win = windows.get(i);
10873+
while (!windows.isEmpty()) {
10874+
final WindowState win = windows.get(windows.size() - 1);
1087510875
removeWindowLocked(win.mSession, win);
1087610876
}
1087710877
mAnimator.removeDisplayLocked(displayId);

0 commit comments

Comments
 (0)