Loading core/java/android/view/WindowManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -3581,7 +3581,8 @@ public interface WindowManager extends ViewManager { /** * If specified, the insets provided by this window will be our window frame minus the * insets specified by providedInternalInsets. * insets specified by providedInternalInsets. This should not be used together with * {@link WindowState#mGivenContentInsets}. If both of them are set, both will be applied. * * @hide */ Loading services/core/java/com/android/server/wm/DisplayPolicy.java +7 −3 Original line number Diff line number Diff line Loading @@ -1122,6 +1122,7 @@ public class DisplayPolicy { if (!mNavButtonForcedVisible) { inOutFrame.inset(windowState.getLayoutingAttrs( displayFrames.mRotation).providedInternalInsets); inOutFrame.inset(win.mGivenContentInsets); } }, Loading Loading @@ -1190,9 +1191,12 @@ public class DisplayPolicy { break; } mDisplayContent.setInsetProvider(insetsType, win, (displayFrames, windowState, inOutFrame) -> inOutFrame.inset( windowState, inOutFrame) -> { inOutFrame.inset( windowState.getLayoutingAttrs(displayFrames.mRotation) .providedInternalInsets), imeFrameProvider); .providedInternalInsets); inOutFrame.inset(win.mGivenContentInsets); }, imeFrameProvider); mInsetsSourceWindowsExceptIme.add(win); } } Loading services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java +22 −0 Original line number Diff line number Diff line Loading @@ -322,4 +322,26 @@ public class DisplayPolicyTests extends WindowTestsBase { assertFalse(navBarSource.getFrame().isEmpty()); assertTrue(imeSource.getFrame().contains(navBarSource.getFrame())); } @UseTestDisplay(addWindows = { W_NAVIGATION_BAR }) @Test public void testInsetsGivenContentFrame() { final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy(); final DisplayInfo displayInfo = new DisplayInfo(); displayInfo.logicalWidth = 1000; displayInfo.logicalHeight = 2000; displayInfo.rotation = ROTATION_0; WindowManager.LayoutParams attrs = mNavBarWindow.mAttrs; displayPolicy.addWindowLw(mNavBarWindow, attrs); mNavBarWindow.setRequestedSize(attrs.width, attrs.height); mNavBarWindow.getControllableInsetProvider().setServerVisible(true); mNavBarWindow.mGivenContentInsets.set(0, 10, 0, 0); displayPolicy.layoutWindowLw(mNavBarWindow, null, mDisplayContent.mDisplayFrames); final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState(); final InsetsSource navBarSource = state.peekSource(ITYPE_NAVIGATION_BAR); assertEquals(attrs.height - 10, navBarSource.getFrame().height()); } } Loading
core/java/android/view/WindowManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -3581,7 +3581,8 @@ public interface WindowManager extends ViewManager { /** * If specified, the insets provided by this window will be our window frame minus the * insets specified by providedInternalInsets. * insets specified by providedInternalInsets. This should not be used together with * {@link WindowState#mGivenContentInsets}. If both of them are set, both will be applied. * * @hide */ Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +7 −3 Original line number Diff line number Diff line Loading @@ -1122,6 +1122,7 @@ public class DisplayPolicy { if (!mNavButtonForcedVisible) { inOutFrame.inset(windowState.getLayoutingAttrs( displayFrames.mRotation).providedInternalInsets); inOutFrame.inset(win.mGivenContentInsets); } }, Loading Loading @@ -1190,9 +1191,12 @@ public class DisplayPolicy { break; } mDisplayContent.setInsetProvider(insetsType, win, (displayFrames, windowState, inOutFrame) -> inOutFrame.inset( windowState, inOutFrame) -> { inOutFrame.inset( windowState.getLayoutingAttrs(displayFrames.mRotation) .providedInternalInsets), imeFrameProvider); .providedInternalInsets); inOutFrame.inset(win.mGivenContentInsets); }, imeFrameProvider); mInsetsSourceWindowsExceptIme.add(win); } } Loading
services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java +22 −0 Original line number Diff line number Diff line Loading @@ -322,4 +322,26 @@ public class DisplayPolicyTests extends WindowTestsBase { assertFalse(navBarSource.getFrame().isEmpty()); assertTrue(imeSource.getFrame().contains(navBarSource.getFrame())); } @UseTestDisplay(addWindows = { W_NAVIGATION_BAR }) @Test public void testInsetsGivenContentFrame() { final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy(); final DisplayInfo displayInfo = new DisplayInfo(); displayInfo.logicalWidth = 1000; displayInfo.logicalHeight = 2000; displayInfo.rotation = ROTATION_0; WindowManager.LayoutParams attrs = mNavBarWindow.mAttrs; displayPolicy.addWindowLw(mNavBarWindow, attrs); mNavBarWindow.setRequestedSize(attrs.width, attrs.height); mNavBarWindow.getControllableInsetProvider().setServerVisible(true); mNavBarWindow.mGivenContentInsets.set(0, 10, 0, 0); displayPolicy.layoutWindowLw(mNavBarWindow, null, mDisplayContent.mDisplayFrames); final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState(); final InsetsSource navBarSource = state.peekSource(ITYPE_NAVIGATION_BAR); assertEquals(attrs.height - 10, navBarSource.getFrame().height()); } }