Loading services/core/java/com/android/server/wm/DisplayContent.java +12 −8 Original line number Diff line number Diff line Loading @@ -3457,11 +3457,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } private void updateImeParent() { // Force attaching IME to the display when magnifying, or it would be magnified with // target app together. final boolean shouldAttachToDisplay = (mMagnificationSpec != null); final SurfaceControl newParent = shouldAttachToDisplay ? mWindowContainers.getSurfaceControl() : computeImeParent(); final SurfaceControl newParent = computeImeParent(); if (newParent != null) { getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent); scheduleAnimation(); Loading @@ -3473,16 +3469,19 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ @VisibleForTesting SurfaceControl computeImeParent() { // Force attaching IME to the display when magnifying, or it would be magnified with // target app together. final boolean allowAttachToApp = (mMagnificationSpec == null); // Attach it to app if the target is part of an app and such app is covering the entire // screen. If it's not covering the entire screen the IME might extend beyond the apps // bounds. if (isImeAttachedToApp()) { if (allowAttachToApp && isImeAttachedToApp()) { return mInputMethodTarget.mActivityRecord.getSurfaceControl(); } // Otherwise, we just attach it to the display. return mWindowContainers.getSurfaceControl(); // Otherwise, we just attach it to where the display area policy put it. return mImeWindowsContainers.getParent().getSurfaceControl(); } void setLayoutNeeded() { Loading Loading @@ -4727,6 +4726,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mWindowContainers.getSurfaceControl(); } @VisibleForTesting WindowContainer<?> getImeContainer() { return mImeWindowsContainers; } SurfaceControl getOverlayLayer() { return mOverlayContainers.getSurfaceControl(); } Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +4 −3 Original line number Diff line number Diff line Loading @@ -826,7 +826,7 @@ public class DisplayContentTests extends WindowTestsBase { dc.mInputMethodTarget = createWindow(null, TYPE_STATUS_BAR, "app"); dc.mInputMethodTarget.setWindowingMode( WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); assertEquals(dc.getWindowingLayer(), dc.computeImeParent()); assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent()); } } Loading @@ -836,7 +836,8 @@ public class DisplayContentTests extends WindowTestsBase { doReturn(false).when(mAppWindow.mActivityRecord).matchParentBounds(); mDisplayContent.mInputMethodTarget = mAppWindow; // The surface parent of IME should be the display instead of app window. assertEquals(mDisplayContent.getWindowingLayer(), mDisplayContent.computeImeParent()); assertEquals(mDisplayContent.getImeContainer().getParentSurfaceControl(), mDisplayContent.computeImeParent()); } @Test Loading @@ -845,7 +846,7 @@ public class DisplayContentTests extends WindowTestsBase { new InsetsModeSession(ViewRootImpl.NEW_INSETS_MODE_IME)) { final DisplayContent dc = createNewDisplay(); dc.mInputMethodTarget = createWindow(null, TYPE_STATUS_BAR, "statusBar"); assertEquals(dc.getWindowingLayer(), dc.computeImeParent()); assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent()); } } Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +12 −8 Original line number Diff line number Diff line Loading @@ -3457,11 +3457,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } private void updateImeParent() { // Force attaching IME to the display when magnifying, or it would be magnified with // target app together. final boolean shouldAttachToDisplay = (mMagnificationSpec != null); final SurfaceControl newParent = shouldAttachToDisplay ? mWindowContainers.getSurfaceControl() : computeImeParent(); final SurfaceControl newParent = computeImeParent(); if (newParent != null) { getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent); scheduleAnimation(); Loading @@ -3473,16 +3469,19 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ @VisibleForTesting SurfaceControl computeImeParent() { // Force attaching IME to the display when magnifying, or it would be magnified with // target app together. final boolean allowAttachToApp = (mMagnificationSpec == null); // Attach it to app if the target is part of an app and such app is covering the entire // screen. If it's not covering the entire screen the IME might extend beyond the apps // bounds. if (isImeAttachedToApp()) { if (allowAttachToApp && isImeAttachedToApp()) { return mInputMethodTarget.mActivityRecord.getSurfaceControl(); } // Otherwise, we just attach it to the display. return mWindowContainers.getSurfaceControl(); // Otherwise, we just attach it to where the display area policy put it. return mImeWindowsContainers.getParent().getSurfaceControl(); } void setLayoutNeeded() { Loading Loading @@ -4727,6 +4726,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mWindowContainers.getSurfaceControl(); } @VisibleForTesting WindowContainer<?> getImeContainer() { return mImeWindowsContainers; } SurfaceControl getOverlayLayer() { return mOverlayContainers.getSurfaceControl(); } Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +4 −3 Original line number Diff line number Diff line Loading @@ -826,7 +826,7 @@ public class DisplayContentTests extends WindowTestsBase { dc.mInputMethodTarget = createWindow(null, TYPE_STATUS_BAR, "app"); dc.mInputMethodTarget.setWindowingMode( WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); assertEquals(dc.getWindowingLayer(), dc.computeImeParent()); assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent()); } } Loading @@ -836,7 +836,8 @@ public class DisplayContentTests extends WindowTestsBase { doReturn(false).when(mAppWindow.mActivityRecord).matchParentBounds(); mDisplayContent.mInputMethodTarget = mAppWindow; // The surface parent of IME should be the display instead of app window. assertEquals(mDisplayContent.getWindowingLayer(), mDisplayContent.computeImeParent()); assertEquals(mDisplayContent.getImeContainer().getParentSurfaceControl(), mDisplayContent.computeImeParent()); } @Test Loading @@ -845,7 +846,7 @@ public class DisplayContentTests extends WindowTestsBase { new InsetsModeSession(ViewRootImpl.NEW_INSETS_MODE_IME)) { final DisplayContent dc = createNewDisplay(); dc.mInputMethodTarget = createWindow(null, TYPE_STATUS_BAR, "statusBar"); assertEquals(dc.getWindowingLayer(), dc.computeImeParent()); assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent()); } } Loading