From 5e69fda6d9b1a08e2b0c1716ce65e03b2ea1c2d1 Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Sun, 8 Nov 2015 12:58:34 -0800 Subject: Ignore wallpaper when looking for a position for a free window. Wallpaper wanders through the window list, for example to position itself directly behind keyguard. Because of this it will break the ordering based on WindowState.mBaseLayer. There might windows with higher mBaseLayer behind it and we don't want the new window to appear above them. An example of this is adding of the docked stack divider. Consider a scenario with the following ordering (top to bottom): keyguard, wallpaper, assist preview, apps. We want the dock divider to land below the assist preview, so the dock divider must ignore the wallpaper, with which it shares the base layer. Bug: 25564817 Change-Id: I5bab792d972f845931b54db9f9ae5ff9a4a0e9b3 --- .../core/java/com/android/server/wm/WindowManagerService.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 3205c6cca53f..5e68aa2d4aae 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1242,7 +1242,16 @@ public class WindowManagerService extends IWindowManager.Stub final int myLayer = win.mBaseLayer; int i; for (i = windows.size() - 1; i >= 0; i--) { - if (windows.get(i).mBaseLayer <= myLayer) { + final WindowState otherWin = windows.get(i); + if (otherWin.getBaseType() != TYPE_WALLPAPER && otherWin.mBaseLayer <= myLayer) { + // Wallpaper wanders through the window list, for example to position itself + // directly behind keyguard. Because of this it will break the ordering based on + // WindowState.mBaseLayer. There might windows with higher mBaseLayer behind it and + // we don't want the new window to appear above them. An example of this is adding + // of the docked stack divider. Consider a scenario with the following ordering (top + // to bottom): keyguard, wallpaper, assist preview, apps. We want the dock divider + // to land below the assist preview, so the dock divider must ignore the wallpaper, + // with which it shares the base layer. break; } } -- cgit v1.2.3-59-g8ed1b