summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java34
-rw-r--r--services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java19
2 files changed, 44 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index c2ac905219ea..9eab61c40323 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -50,6 +50,7 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
@@ -4331,15 +4332,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
}
- boolean usesRelativeZOrdering() {
- if (!isChildWindow()) {
- return false;
- } else if (mAttrs.type == TYPE_APPLICATION_MEDIA_OVERLAY) {
- return true;
- } else {
- return false;
- }
- }
@Override
boolean shouldMagnify() {
@@ -4414,4 +4406,28 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
public boolean isDimming() {
return mIsDimming;
}
+
+ // TODO(b/70040778): We should aim to eliminate the last user of TYPE_APPLICATION_MEDIA
+ // then we can drop all negative layering on the windowing side and simply inherit
+ // the default implementation here.
+ public void assignChildLayers(Transaction t) {
+ int layer = 1;
+ for (int i = 0; i < mChildren.size(); i++) {
+ final WindowState w = mChildren.get(i);
+
+ // APPLICATION_MEDIA_OVERLAY needs to go above APPLICATION_MEDIA
+ // while they both need to go below the main window. However the
+ // relative layering of multiple APPLICATION_MEDIA/OVERLAY has never
+ // been defined and so we can use static layers and leave it that way.
+ if (w.mAttrs.type == TYPE_APPLICATION_MEDIA) {
+ w.assignLayer(t, -2);
+ } else if (w.mAttrs.type == TYPE_APPLICATION_MEDIA_OVERLAY) {
+ w.assignLayer(t, -1);
+ } else {
+ w.assignLayer(t, layer);
+ }
+ w.assignChildLayers(t);
+ layer++;
+ }
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java
index 04f5e5e919aa..e5cbdba7b507 100644
--- a/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java
@@ -39,6 +39,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
@@ -343,4 +344,22 @@ public class ZOrderingTests extends WindowTestsBase {
assertWindowLayerGreaterThan(mTransaction, statusBarPanel, mStatusBarWindow);
assertWindowLayerGreaterThan(mTransaction, statusBarSubPanel, statusBarPanel);
}
+
+ @Test
+ public void testAssignWindowLayers_ForNegativelyZOrderedSubtype() throws Exception {
+ // TODO(b/70040778): We should aim to eliminate the last user of TYPE_APPLICATION_MEDIA
+ // then we can drop all negative layering on the windowing side.
+
+ final WindowState anyWindow =
+ createWindow(null, TYPE_BASE_APPLICATION, mDisplayContent, "anyWindow");
+ final WindowState child = createWindow(anyWindow, TYPE_APPLICATION_MEDIA, mDisplayContent,
+ "TypeApplicationMediaChild");
+ final WindowState mediaOverlayChild = createWindow(anyWindow, TYPE_APPLICATION_MEDIA_OVERLAY,
+ mDisplayContent, "TypeApplicationMediaOverlayChild");
+
+ mDisplayContent.assignChildLayers(mTransaction);
+
+ assertWindowLayerGreaterThan(mTransaction, anyWindow, mediaOverlayChild);
+ assertWindowLayerGreaterThan(mTransaction, mediaOverlayChild, child);
+ }
}