diff options
| author | 2018-01-08 12:02:07 +0000 | |
|---|---|---|
| committer | 2018-01-08 12:02:07 +0000 | |
| commit | ab4c1eaa41fb7fe2b7cbf0982bc6abbfe92e094a (patch) | |
| tree | aa6cfe23883f520253a6ba53b347e8f6c89884e1 | |
| parent | 500bb82784ac2debdcbc0dbb2218c40a87d02781 (diff) | |
| parent | 59f3e926cedfac38288e7008c4b9eca1eb8cbed6 (diff) | |
Merge "Copy child window list when destroying surface"
| -rw-r--r-- | services/core/java/com/android/server/wm/AppWindowToken.java | 3 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index dcd88dd074d1..01e925e509c8 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -649,8 +649,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean destroyedSomething = false; // Copying to a different list as multiple children can be removed. - // TODO: Not sure why this is needed. - final LinkedList<WindowState> children = new LinkedList<>(mChildren); + final ArrayList<WindowState> children = new ArrayList<>(mChildren); for (int i = children.size() - 1; i >= 0; i--) { final WindowState win = children.get(i); destroyedSomething |= win.destroySurface(cleanupOnResume, mAppStopped); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index fcbc80234947..d10cb24fc353 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2664,8 +2664,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP boolean destroySurface(boolean cleanupOnResume, boolean appStopped) { boolean destroyedSomething = false; - for (int i = mChildren.size() - 1; i >= 0; --i) { - final WindowState c = mChildren.get(i); + + // Copying to a different list as multiple children can be removed. + final ArrayList<WindowState> childWindows = new ArrayList<>(mChildren); + for (int i = childWindows.size() - 1; i >= 0; --i) { + final WindowState c = childWindows.get(i); destroyedSomething |= c.destroySurface(cleanupOnResume, appStopped); } @@ -3923,8 +3926,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (!mChildren.isEmpty()) { // Copying to a different list as multiple children can be removed. - // TODO: Not sure if we really need to copy this into a different list. - final LinkedList<WindowState> childWindows = new LinkedList(mChildren); + final ArrayList<WindowState> childWindows = new ArrayList<>(mChildren); for (int i = childWindows.size() - 1; i >= 0; i--) { childWindows.get(i).onExitAnimationDone(); } |