am 285970cf: Merge "Fixed index out of bounds issue when removing windows." into lmp-mr1-dev

automerge: 4937d95

* commit '4937d95aa4f6eecec288f1b4f2d4cfd7f4b48044':
  Fixed index out of bounds issue when removing windows.
This commit is contained in:
Wale Ogunwale
2014-11-11 18:19:52 +00:00
committed by android-build-merger

View File

@@ -252,11 +252,17 @@ class AppWindowToken extends WindowToken {
return false; return false;
} }
@Override
void removeAllWindows() { void removeAllWindows() {
for (int winNdx = allAppWindows.size() - 1; winNdx >= 0; --winNdx) { int winNdx;
WindowState win = allAppWindows.get(winNdx); while ((winNdx = allAppWindows.size()) > 0) {
if (WindowManagerService.DEBUG_WINDOW_MOVEMENT) Slog.w(WindowManagerService.TAG, WindowState win = allAppWindows.get(winNdx - 1);
"removeAllWindows: removing win=" + win); if (WindowManagerService.DEBUG_WINDOW_MOVEMENT) {
Slog.w(WindowManagerService.TAG, "removeAllWindows: removing win=" + win);
}
// {@link WindowManagerService.removeWindowLocked} may remove multiple entries from
// {@link #allAppWindows} if the window to be removed has child windows.
win.mService.removeWindowLocked(win.mSession, win); win.mService.removeWindowLocked(win.mSession, win);
} }
} }