From 0735697c9d29874246ccd14164d6cf59708e6331 Mon Sep 17 00:00:00 2001 From: tingna_sung Date: Tue, 14 Oct 2014 18:05:34 +0800 Subject: [PATCH] Fix Presentation window is removed on stack change If an activity show a Presentation window and this activity is moved to bottom or top, thus this Presentation window will be removed from its display window list, and no chance to be added back into window container; It will cause the incorrect state that Presentation window is lost from secondary display window list(displayContent.mWindows), but still exist in app token's window list(appWindowToken.allAppWindows); Moreover, once this activity resume again, Presentation window is not shown because it's lost. In this way, don't remove non-target display app windows due to only target(or called default) display windows are removed temporarily and re-sorted then added back into window list later. Change-Id: I8960ce191f6c662455cba5a0a5e6a1ff9ef03ae1 Signed-off-by: tingna_sung --- .../com/android/server/wm/WindowManagerService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 837672aaa146d..f8e8c6df875db 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -4820,8 +4820,19 @@ public class WindowManagerService extends IWindowManager.Stub if (NW > 0) { mWindowsChanged = true; } + int targetDisplayId = -1; + Task targetTask = mTaskIdToTask.get(token.appWindowToken.groupId); + if (targetTask != null) { + DisplayContent targetDisplayContent = targetTask.getDisplayContent(); + if (targetDisplayContent != null) { + targetDisplayId = targetDisplayContent.getDisplayId(); + } + } for (int i = 0; i < NW; i++) { WindowState win = windows.get(i); + if (targetDisplayId != -1 && win.getDisplayId() != targetDisplayId) { + continue; + } if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Tmp removing app window " + win); win.getWindowList().remove(win); int j = win.mChildWindows.size();