From 26b7b43d172a7a2be39a109f1f6697162c4ee642 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Wed, 3 Feb 2016 14:12:08 -0800 Subject: Fixed some issues with layer adjustment for special windows. - Adjust layers of all windows in pinned stack. The surface view of a pinned activity will be hidden during transition animations because we were only adjusting the layer of the main app window when we adjust special windows in WindowLayersController. We now adjust the layers of all windows in the pinned stack. - Also adjust layers for all windows in the docked stack for the same reasons - Adjust layers for replacing windows that was lost when the code was moved to the separate class. Bug: 26697719 Change-Id: I42fc3f9a51de9999157bcc7fee25a334b3e93ea1 --- .../android/server/wm/WindowLayersController.java | 61 +++++++++++++--------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowLayersController.java b/services/core/java/com/android/server/wm/WindowLayersController.java index 2cf26180441f..d843a8ce398f 100644 --- a/services/core/java/com/android/server/wm/WindowLayersController.java +++ b/services/core/java/com/android/server/wm/WindowLayersController.java @@ -16,12 +16,14 @@ package com.android.server.wm; -import android.app.ActivityManager.StackId; import android.util.Slog; import android.view.Display; import java.io.PrintWriter; +import java.util.ArrayDeque; +import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; +import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYERS; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; @@ -55,10 +57,10 @@ public class WindowLayersController { } private int mHighestApplicationLayer = 0; - private WindowState mPinnedWindow = null; - private WindowState mDockedWindow = null; + private ArrayDeque mPinnedWindows = new ArrayDeque<>(); + private ArrayDeque mDockedWindows = new ArrayDeque<>(); private WindowState mDockDivider = null; - private WindowState mReplacingWindow = null; + private ArrayDeque mReplacingWindows = new ArrayDeque<>(); final void assignLayersLocked(WindowList windows) { if (DEBUG_LAYERS) Slog.v(TAG_WM, "Assigning layers based on windows=" + windows, @@ -169,43 +171,54 @@ public class WindowLayersController { private void clear() { mHighestApplicationLayer = 0; - mPinnedWindow = null; - mDockedWindow = null; + mPinnedWindows.clear(); + mDockedWindows.clear(); + mReplacingWindows.clear(); mDockDivider = null; } private void collectSpecialWindows(WindowState w) { if (w.mAttrs.type == TYPE_DOCK_DIVIDER) { mDockDivider = w; - } else { - final TaskStack stack = w.getStack(); - if (stack == null) { - return; - } - if (stack.mStackId == StackId.PINNED_STACK_ID) { - mPinnedWindow = w; - } else if (stack.mStackId == StackId.DOCKED_STACK_ID) { - mDockedWindow = w; - } + return; + } + if (w.mWillReplaceWindow) { + mReplacingWindows.add(w); + } + final TaskStack stack = w.getStack(); + if (stack == null) { + return; + } + if (stack.mStackId == PINNED_STACK_ID) { + mPinnedWindows.add(w); + } else if (stack.mStackId == DOCKED_STACK_ID) { + mDockedWindows.add(w); } } private void adjustSpecialWindows() { int layer = mHighestApplicationLayer + 1; - // For pinned and docked stack window, we want to make them above other windows - // also when these windows are animating. - layer = assignAndIncreaseLayerIfNeeded(mDockedWindow, layer); + // For pinned and docked stack window, we want to make them above other windows also when + // these windows are animating. + while (!mDockedWindows.isEmpty()) { + layer = assignAndIncreaseLayerIfNeeded(mDockedWindows.remove(), layer); + } // Leave some space here so the dim layer while dismissing docked/fullscreen stack has space // below the divider but above the app windows. It needs to be below the divider in because // the divider sometimes overlaps the app windows. layer++; layer = assignAndIncreaseLayerIfNeeded(mDockDivider, layer); - // We know that we will be animating a relaunching window in the near future, - // which will receive a z-order increase. We want the replaced window to - // immediately receive the same treatment, e.g. to be above the dock divider. - layer = assignAndIncreaseLayerIfNeeded(mReplacingWindow, layer); - layer = assignAndIncreaseLayerIfNeeded(mPinnedWindow, layer); + // We know that we will be animating a relaunching window in the near future, which will + // receive a z-order increase. We want the replaced window to immediately receive the same + // treatment, e.g. to be above the dock divider. + while (!mReplacingWindows.isEmpty()) { + layer = assignAndIncreaseLayerIfNeeded(mReplacingWindows.remove(), layer); + } + + while (!mPinnedWindows.isEmpty()) { + layer = assignAndIncreaseLayerIfNeeded(mPinnedWindows.remove(), layer); + } } private int assignAndIncreaseLayerIfNeeded(WindowState win, int layer) { -- cgit v1.2.3-59-g8ed1b