Loading services/core/java/com/android/server/wm/DisplayContent.java +5 −1 Original line number Diff line number Diff line Loading @@ -729,8 +729,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // Sets mBehindIme for each window. Windows behind IME can get IME insets. if (w.mBehindIme != mTmpWindowsBehindIme) { w.mBehindIme = mTmpWindowsBehindIme; if (getInsetsStateController().getRawInsetsState().getSourceOrDefaultVisibility( ITYPE_IME)) { // If IME is invisible, behind IME or not doesn't make the insets different. mWinInsetsChanged.add(w); } } if (w == mInputMethodWindow) { mTmpWindowsBehindIme = true; } Loading services/core/java/com/android/server/wm/InsetsStateController.java +1 −1 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ class InsetsStateController { // (e.g., z-order) have changed. They can affect the insets states that we dispatch to // the clients. for (int i = winInsetsChanged.size() - 1; i >= 0; i--) { winInsetsChanged.get(i).notifyInsetsChanged(); mDispatchInsetsChanged.accept(winInsetsChanged.get(i)); } } winInsetsChanged.clear(); Loading services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java +15 −8 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; Loading @@ -41,7 +40,6 @@ import static org.mockito.Mockito.verify; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; import android.view.InsetsSource; import android.view.InsetsSourceControl; import android.view.InsetsState; import android.view.test.InsetsModeSession; Loading Loading @@ -188,13 +186,23 @@ public class InsetsStateControllerTest extends WindowTestsBase { @Test public void testStripForDispatch_imeOrderChanged() { getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null); // This can be the IME z-order target while app cannot be the IME z-order target. // This is also the only IME control target in this test, so IME won't be invisible caused // by the control-target change. mDisplayContent.mInputMethodInputTarget = createWindow(null, TYPE_APPLICATION, "base"); // This window can be the IME target while app cannot be the IME target. createWindow(null, TYPE_APPLICATION, "base"); // Make IME and stay visible during the test. mImeWindow.setHasSurface(true); getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null); getController().onImeControlTargetChanged(mDisplayContent.mInputMethodInputTarget); final InsetsState requestedState = new InsetsState(); requestedState.getSource(ITYPE_IME).setVisible(true); mDisplayContent.mInputMethodInputTarget.updateRequestedInsetsState(requestedState); getController().onInsetsModified(mDisplayContent.mInputMethodInputTarget, requestedState); // Send our spy window (app) into the system so that we can detect the invocation. final WindowState win = createWindow(null, TYPE_APPLICATION, "app"); win.setHasSurface(true); final WindowToken parent = win.mToken; parent.removeChild(win); final WindowState app = spy(win); Loading @@ -206,7 +214,7 @@ public class InsetsStateControllerTest extends WindowTestsBase { mDisplayContent.applySurfaceChangesTransaction(); // app won't get visible IME insets while above IME even when IME is visible. getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true); assertTrue(getController().getRawInsetsState().getSourceOrDefaultVisibility(ITYPE_IME)); assertFalse(getController().getInsetsForDispatch(app).getSource(ITYPE_IME).isVisible()); // Reset invocation counter. Loading @@ -220,8 +228,7 @@ public class InsetsStateControllerTest extends WindowTestsBase { // Make sure app got notified. verify(app, atLeast(1)).notifyInsetsChanged(); // app will get visible IME insets while below IME when IME is visible. getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true); // app will get visible IME insets while below IME. assertTrue(getController().getInsetsForDispatch(app).getSource(ITYPE_IME).isVisible()); } Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +5 −1 Original line number Diff line number Diff line Loading @@ -729,8 +729,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // Sets mBehindIme for each window. Windows behind IME can get IME insets. if (w.mBehindIme != mTmpWindowsBehindIme) { w.mBehindIme = mTmpWindowsBehindIme; if (getInsetsStateController().getRawInsetsState().getSourceOrDefaultVisibility( ITYPE_IME)) { // If IME is invisible, behind IME or not doesn't make the insets different. mWinInsetsChanged.add(w); } } if (w == mInputMethodWindow) { mTmpWindowsBehindIme = true; } Loading
services/core/java/com/android/server/wm/InsetsStateController.java +1 −1 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ class InsetsStateController { // (e.g., z-order) have changed. They can affect the insets states that we dispatch to // the clients. for (int i = winInsetsChanged.size() - 1; i >= 0; i--) { winInsetsChanged.get(i).notifyInsetsChanged(); mDispatchInsetsChanged.accept(winInsetsChanged.get(i)); } } winInsetsChanged.clear(); Loading
services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java +15 −8 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; Loading @@ -41,7 +40,6 @@ import static org.mockito.Mockito.verify; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; import android.view.InsetsSource; import android.view.InsetsSourceControl; import android.view.InsetsState; import android.view.test.InsetsModeSession; Loading Loading @@ -188,13 +186,23 @@ public class InsetsStateControllerTest extends WindowTestsBase { @Test public void testStripForDispatch_imeOrderChanged() { getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null); // This can be the IME z-order target while app cannot be the IME z-order target. // This is also the only IME control target in this test, so IME won't be invisible caused // by the control-target change. mDisplayContent.mInputMethodInputTarget = createWindow(null, TYPE_APPLICATION, "base"); // This window can be the IME target while app cannot be the IME target. createWindow(null, TYPE_APPLICATION, "base"); // Make IME and stay visible during the test. mImeWindow.setHasSurface(true); getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null); getController().onImeControlTargetChanged(mDisplayContent.mInputMethodInputTarget); final InsetsState requestedState = new InsetsState(); requestedState.getSource(ITYPE_IME).setVisible(true); mDisplayContent.mInputMethodInputTarget.updateRequestedInsetsState(requestedState); getController().onInsetsModified(mDisplayContent.mInputMethodInputTarget, requestedState); // Send our spy window (app) into the system so that we can detect the invocation. final WindowState win = createWindow(null, TYPE_APPLICATION, "app"); win.setHasSurface(true); final WindowToken parent = win.mToken; parent.removeChild(win); final WindowState app = spy(win); Loading @@ -206,7 +214,7 @@ public class InsetsStateControllerTest extends WindowTestsBase { mDisplayContent.applySurfaceChangesTransaction(); // app won't get visible IME insets while above IME even when IME is visible. getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true); assertTrue(getController().getRawInsetsState().getSourceOrDefaultVisibility(ITYPE_IME)); assertFalse(getController().getInsetsForDispatch(app).getSource(ITYPE_IME).isVisible()); // Reset invocation counter. Loading @@ -220,8 +228,7 @@ public class InsetsStateControllerTest extends WindowTestsBase { // Make sure app got notified. verify(app, atLeast(1)).notifyInsetsChanged(); // app will get visible IME insets while below IME when IME is visible. getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true); // app will get visible IME insets while below IME. assertTrue(getController().getInsetsForDispatch(app).getSource(ITYPE_IME).isVisible()); } Loading