Loading services/core/java/com/android/server/wm/WindowState.java +5 −3 Original line number Diff line number Diff line Loading @@ -5679,9 +5679,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } boolean needsRelativeLayeringToIme() { // We only use the relative layering mode in split screen, as part of elevating the IME // and windows above it's target above the docked divider. if (!inSplitScreenWindowingMode()) { // We use the relative layering when IME isn't attached to the app. Such as part of // elevating the IME and windows above it's target above the docked divider in // split-screen, or make the popupMenu to be above the IME when the parent window is the // IME layering target in bubble/freeform mode. if (mDisplayContent.isImeAttachedToApp()) { return false; } Loading services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +3 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.view.InsetsState.ITYPE_IME; Loading Loading @@ -835,8 +836,7 @@ public class WindowStateTests extends WindowTestsBase { WindowState sameTokenWindow = createWindow(null, TYPE_BASE_APPLICATION, mAppWindow.mToken, "SameTokenWindow"); mDisplayContent.setImeLayeringTarget(mAppWindow); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode( WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); assertTrue(sameTokenWindow.needsRelativeLayeringToIme()); sameTokenWindow.removeImmediately(); assertFalse(sameTokenWindow.needsRelativeLayeringToIme()); Loading @@ -848,8 +848,7 @@ public class WindowStateTests extends WindowTestsBase { WindowState sameTokenWindow = createWindow(null, TYPE_APPLICATION_STARTING, mAppWindow.mToken, "SameTokenWindow"); mDisplayContent.setImeLayeringTarget(mAppWindow); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode( WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); assertFalse(sameTokenWindow.needsRelativeLayeringToIme()); } Loading services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java +25 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; 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; Loading @@ -37,6 +38,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -493,4 +495,27 @@ public class ZOrderingTests extends WindowTestsBase { assertZOrderGreaterThan(mTransaction, mNavBarWindow.mToken.getSurfaceControl(), mDisplayContent.getImeContainer().getSurfaceControl()); } @Test public void testPopupWindowAndParentIsImeTarget_expectHigherThanIme_inMultiWindow() { // Simulate the app window is in multi windowing mode and being IME target mAppWindow.getConfiguration().windowConfiguration.setWindowingMode( WINDOWING_MODE_MULTI_WINDOW); mDisplayContent.setImeLayeringTarget(mAppWindow); mDisplayContent.setImeInputTarget(mAppWindow); // Create a popupWindow assertWindowHigher(mImeWindow, mAppWindow); final WindowState popupWindow = createWindow(mAppWindow, TYPE_APPLICATION_PANEL, mDisplayContent, "PopupWindow"); spyOn(popupWindow); mDisplayContent.assignChildLayers(mTransaction); // Verify the surface layer of the popupWindow should higher than IME verify(popupWindow).needsRelativeLayeringToIme(); assertThat(popupWindow.needsRelativeLayeringToIme()).isTrue(); assertZOrderGreaterThan(mTransaction, popupWindow.getSurfaceControl(), mDisplayContent.getImeContainer().getSurfaceControl()); } } Loading
services/core/java/com/android/server/wm/WindowState.java +5 −3 Original line number Diff line number Diff line Loading @@ -5679,9 +5679,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } boolean needsRelativeLayeringToIme() { // We only use the relative layering mode in split screen, as part of elevating the IME // and windows above it's target above the docked divider. if (!inSplitScreenWindowingMode()) { // We use the relative layering when IME isn't attached to the app. Such as part of // elevating the IME and windows above it's target above the docked divider in // split-screen, or make the popupMenu to be above the IME when the parent window is the // IME layering target in bubble/freeform mode. if (mDisplayContent.isImeAttachedToApp()) { return false; } Loading
services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +3 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.view.InsetsState.ITYPE_IME; Loading Loading @@ -835,8 +836,7 @@ public class WindowStateTests extends WindowTestsBase { WindowState sameTokenWindow = createWindow(null, TYPE_BASE_APPLICATION, mAppWindow.mToken, "SameTokenWindow"); mDisplayContent.setImeLayeringTarget(mAppWindow); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode( WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); assertTrue(sameTokenWindow.needsRelativeLayeringToIme()); sameTokenWindow.removeImmediately(); assertFalse(sameTokenWindow.needsRelativeLayeringToIme()); Loading @@ -848,8 +848,7 @@ public class WindowStateTests extends WindowTestsBase { WindowState sameTokenWindow = createWindow(null, TYPE_APPLICATION_STARTING, mAppWindow.mToken, "SameTokenWindow"); mDisplayContent.setImeLayeringTarget(mAppWindow); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode( WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); assertFalse(sameTokenWindow.needsRelativeLayeringToIme()); } Loading
services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java +25 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; 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; Loading @@ -37,6 +38,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -493,4 +495,27 @@ public class ZOrderingTests extends WindowTestsBase { assertZOrderGreaterThan(mTransaction, mNavBarWindow.mToken.getSurfaceControl(), mDisplayContent.getImeContainer().getSurfaceControl()); } @Test public void testPopupWindowAndParentIsImeTarget_expectHigherThanIme_inMultiWindow() { // Simulate the app window is in multi windowing mode and being IME target mAppWindow.getConfiguration().windowConfiguration.setWindowingMode( WINDOWING_MODE_MULTI_WINDOW); mDisplayContent.setImeLayeringTarget(mAppWindow); mDisplayContent.setImeInputTarget(mAppWindow); // Create a popupWindow assertWindowHigher(mImeWindow, mAppWindow); final WindowState popupWindow = createWindow(mAppWindow, TYPE_APPLICATION_PANEL, mDisplayContent, "PopupWindow"); spyOn(popupWindow); mDisplayContent.assignChildLayers(mTransaction); // Verify the surface layer of the popupWindow should higher than IME verify(popupWindow).needsRelativeLayeringToIme(); assertThat(popupWindow.needsRelativeLayeringToIme()).isTrue(); assertZOrderGreaterThan(mTransaction, popupWindow.getSurfaceControl(), mDisplayContent.getImeContainer().getSurfaceControl()); } }