am 25418aab: Merge "Ensure arraylist index is montonically decreasing" into lmp-mr1-dev
* commit '25418aabb687b39a9e5bbe7c387bfcb81bde1222': Ensure arraylist index is montonically decreasing
This commit is contained in:
@@ -254,15 +254,18 @@ class AppWindowToken extends WindowToken {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void removeAllWindows() {
|
void removeAllWindows() {
|
||||||
int winNdx;
|
for (int winNdx = allAppWindows.size() - 1; winNdx >= 0;
|
||||||
while ((winNdx = allAppWindows.size()) > 0) {
|
// removeWindowLocked at bottom of loop may remove multiple entries from
|
||||||
WindowState win = allAppWindows.get(winNdx - 1);
|
// allAppWindows if the window to be removed has child windows. It also may
|
||||||
|
// not remove any windows from allAppWindows at all if win is exiting and
|
||||||
|
// currently animating away. This ensures that winNdx is monotonically decreasing
|
||||||
|
// and never beyond allAppWindows bounds.
|
||||||
|
winNdx = Math.min(winNdx - 1, allAppWindows.size() - 1)) {
|
||||||
|
WindowState win = allAppWindows.get(winNdx);
|
||||||
if (WindowManagerService.DEBUG_WINDOW_MOVEMENT) {
|
if (WindowManagerService.DEBUG_WINDOW_MOVEMENT) {
|
||||||
Slog.w(WindowManagerService.TAG, "removeAllWindows: removing win=" + win);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user