Loading services/core/java/com/android/server/wm/WindowState.java +4 −1 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ import static com.android.server.wm.WindowManagerService.localLOGV; import static com.android.server.wm.WindowStateAnimator.COMMIT_DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN; import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER; import static com.android.server.wm.WindowStateAnimator.READY_TO_SHOW; import static com.android.server.wm.WindowStateProto.ANIMATING_EXIT; import static com.android.server.wm.WindowStateProto.ANIMATOR; Loading Loading @@ -4777,7 +4778,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // 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; // The surface of the main window might be preserved. So the child window on top of the main // window should be also on top of the preserved surface. int layer = PRESERVED_SURFACE_LAYER + 1; for (int i = 0; i < mChildren.size(); i++) { final WindowState w = mChildren.get(i); Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +3 −2 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ import java.io.PrintWriter; class WindowStateAnimator { static final String TAG = TAG_WITH_CLASS_NAME ? "WindowStateAnimator" : TAG_WM; static final int WINDOW_FREEZE_LAYER = TYPE_LAYER_MULTIPLIER * 200; static final int PRESERVED_SURFACE_LAYER = 1; /** * Mode how the window gets clipped by the stack bounds during an animation: The clipping should Loading Loading @@ -373,8 +374,8 @@ class WindowStateAnimator { if (mSurfaceController != null) { // Our SurfaceControl is always at layer 0 within the parent Surface managed by // window-state. We want this old Surface to stay on top of the new one // until we do the swap, so we place it at layer 1. mSurfaceController.mSurfaceControl.setLayer(1); // until we do the swap, so we place it at a positive layer. mSurfaceController.mSurfaceControl.setLayer(PRESERVED_SURFACE_LAYER); } mDestroyPreservedSurfaceUponRedraw = true; mSurfaceDestroyDeferred = true; Loading services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java +28 −0 Original line number Diff line number Diff line Loading @@ -23,15 +23,20 @@ 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.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL; 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_APPLICATION_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER; import static com.google.common.truth.Truth.assertThat; import android.platform.test.annotations.Presubmit; Loading @@ -44,6 +49,7 @@ import androidx.test.filters.SmallTest; import org.junit.After; import org.junit.Test; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; Loading Loading @@ -404,6 +410,28 @@ public class ZOrderingTests extends WindowTestsBase { assertWindowHigher(mediaOverlayChild, child); } @Test public void testAssignWindowLayers_ForPostivelyZOrderedSubtype() { final WindowState anyWindow = createWindow("anyWindow"); final ArrayList<WindowState> childList = new ArrayList<>(); childList.add(createWindow(anyWindow, TYPE_APPLICATION_PANEL, mDisplayContent, "TypeApplicationPanelChild")); childList.add(createWindow(anyWindow, TYPE_APPLICATION_SUB_PANEL, mDisplayContent, "TypeApplicationSubPanelChild")); childList.add(createWindow(anyWindow, TYPE_APPLICATION_ATTACHED_DIALOG, mDisplayContent, "TypeApplicationAttachedDialogChild")); childList.add(createWindow(anyWindow, TYPE_APPLICATION_ABOVE_SUB_PANEL, mDisplayContent, "TypeApplicationAboveSubPanelPanelChild")); final LayerRecordingTransaction t = mTransaction; mDisplayContent.assignChildLayers(t); for (int i = childList.size() - 1; i >= 0; i--) { assertThat(t.getLayer(childList.get(i).getSurfaceControl())) .isGreaterThan(PRESERVED_SURFACE_LAYER); } } @FlakyTest(bugId = 124088319) @Test public void testDockedDividerPosition() { Loading Loading
services/core/java/com/android/server/wm/WindowState.java +4 −1 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ import static com.android.server.wm.WindowManagerService.localLOGV; import static com.android.server.wm.WindowStateAnimator.COMMIT_DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN; import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER; import static com.android.server.wm.WindowStateAnimator.READY_TO_SHOW; import static com.android.server.wm.WindowStateProto.ANIMATING_EXIT; import static com.android.server.wm.WindowStateProto.ANIMATOR; Loading Loading @@ -4777,7 +4778,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // 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; // The surface of the main window might be preserved. So the child window on top of the main // window should be also on top of the preserved surface. int layer = PRESERVED_SURFACE_LAYER + 1; for (int i = 0; i < mChildren.size(); i++) { final WindowState w = mChildren.get(i); Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +3 −2 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ import java.io.PrintWriter; class WindowStateAnimator { static final String TAG = TAG_WITH_CLASS_NAME ? "WindowStateAnimator" : TAG_WM; static final int WINDOW_FREEZE_LAYER = TYPE_LAYER_MULTIPLIER * 200; static final int PRESERVED_SURFACE_LAYER = 1; /** * Mode how the window gets clipped by the stack bounds during an animation: The clipping should Loading Loading @@ -373,8 +374,8 @@ class WindowStateAnimator { if (mSurfaceController != null) { // Our SurfaceControl is always at layer 0 within the parent Surface managed by // window-state. We want this old Surface to stay on top of the new one // until we do the swap, so we place it at layer 1. mSurfaceController.mSurfaceControl.setLayer(1); // until we do the swap, so we place it at a positive layer. mSurfaceController.mSurfaceControl.setLayer(PRESERVED_SURFACE_LAYER); } mDestroyPreservedSurfaceUponRedraw = true; mSurfaceDestroyDeferred = true; Loading
services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java +28 −0 Original line number Diff line number Diff line Loading @@ -23,15 +23,20 @@ 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.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL; 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_APPLICATION_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER; import static com.google.common.truth.Truth.assertThat; import android.platform.test.annotations.Presubmit; Loading @@ -44,6 +49,7 @@ import androidx.test.filters.SmallTest; import org.junit.After; import org.junit.Test; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; Loading Loading @@ -404,6 +410,28 @@ public class ZOrderingTests extends WindowTestsBase { assertWindowHigher(mediaOverlayChild, child); } @Test public void testAssignWindowLayers_ForPostivelyZOrderedSubtype() { final WindowState anyWindow = createWindow("anyWindow"); final ArrayList<WindowState> childList = new ArrayList<>(); childList.add(createWindow(anyWindow, TYPE_APPLICATION_PANEL, mDisplayContent, "TypeApplicationPanelChild")); childList.add(createWindow(anyWindow, TYPE_APPLICATION_SUB_PANEL, mDisplayContent, "TypeApplicationSubPanelChild")); childList.add(createWindow(anyWindow, TYPE_APPLICATION_ATTACHED_DIALOG, mDisplayContent, "TypeApplicationAttachedDialogChild")); childList.add(createWindow(anyWindow, TYPE_APPLICATION_ABOVE_SUB_PANEL, mDisplayContent, "TypeApplicationAboveSubPanelPanelChild")); final LayerRecordingTransaction t = mTransaction; mDisplayContent.assignChildLayers(t); for (int i = childList.size() - 1; i >= 0; i--) { assertThat(t.getLayer(childList.get(i).getSurfaceControl())) .isGreaterThan(PRESERVED_SURFACE_LAYER); } } @FlakyTest(bugId = 124088319) @Test public void testDockedDividerPosition() { Loading