Merge "Use IFP only for non-IME window insets providers" into udc-dev
This commit is contained in:
@@ -1122,7 +1122,6 @@ public class DisplayPolicy {
|
|||||||
inOutFrame.set(windowContainer.getBounds());
|
inOutFrame.set(windowContainer.getBounds());
|
||||||
break;
|
break;
|
||||||
case SOURCE_FRAME:
|
case SOURCE_FRAME:
|
||||||
inOutFrame.inset(win.mGivenContentInsets);
|
|
||||||
extendByCutout =
|
extendByCutout =
|
||||||
(lp.privateFlags & PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT) != 0;
|
(lp.privateFlags & PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT) != 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -218,8 +218,6 @@ class InsetsSourceProvider {
|
|||||||
if (mFrameProvider != null) {
|
if (mFrameProvider != null) {
|
||||||
mFrameProvider.accept(mWindowContainer.getDisplayContent().mDisplayFrames,
|
mFrameProvider.accept(mWindowContainer.getDisplayContent().mDisplayFrames,
|
||||||
mWindowContainer, mSourceFrame);
|
mWindowContainer, mSourceFrame);
|
||||||
} else {
|
|
||||||
mSourceFrame.inset(win.mGivenContentInsets);
|
|
||||||
}
|
}
|
||||||
updateSourceFrameForServerVisibility();
|
updateSourceFrameForServerVisibility();
|
||||||
|
|
||||||
|
|||||||
@@ -428,8 +428,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
boolean mGivenInsetsPending;
|
boolean mGivenInsetsPending;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These are the content insets that were given during layout for
|
* These are the content insets that were given during layout for this window, to be applied to
|
||||||
* this window, to be applied to windows behind it.
|
* windows behind it.
|
||||||
|
* This is only applied to IME windows when corresponding process in DisplayPolicy executed.
|
||||||
*/
|
*/
|
||||||
final Rect mGivenContentInsets = new Rect();
|
final Rect mGivenContentInsets = new Rect();
|
||||||
|
|
||||||
|
|||||||
@@ -352,27 +352,28 @@ public class DisplayPolicyTests extends WindowTestsBase {
|
|||||||
assertTrue(imeSource.getFrame().contains(navBarSource.getFrame()));
|
assertTrue(imeSource.getFrame().contains(navBarSource.getFrame()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SetupWindows(addWindows = W_NAVIGATION_BAR)
|
@SetupWindows(addWindows = W_INPUT_METHOD)
|
||||||
@Test
|
@Test
|
||||||
public void testInsetsGivenContentFrame() {
|
public void testImeInsetsGivenContentFrame() {
|
||||||
final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy();
|
final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy();
|
||||||
final DisplayInfo displayInfo = new DisplayInfo();
|
final DisplayInfo displayInfo = new DisplayInfo();
|
||||||
displayInfo.logicalWidth = 1000;
|
displayInfo.logicalWidth = 1000;
|
||||||
displayInfo.logicalHeight = 2000;
|
displayInfo.logicalHeight = 2000;
|
||||||
displayInfo.rotation = ROTATION_0;
|
displayInfo.rotation = ROTATION_0;
|
||||||
|
|
||||||
WindowManager.LayoutParams attrs = mNavBarWindow.mAttrs;
|
mDisplayContent.setInputMethodWindowLocked(mImeWindow);
|
||||||
displayPolicy.addWindowLw(mNavBarWindow, attrs);
|
mImeWindow.getControllableInsetProvider().setServerVisible(true);
|
||||||
mNavBarWindow.setRequestedSize(attrs.width, attrs.height);
|
|
||||||
mNavBarWindow.getControllableInsetProvider().setServerVisible(true);
|
|
||||||
|
|
||||||
mNavBarWindow.mGivenContentInsets.set(0, 10, 0, 0);
|
mImeWindow.mGivenContentInsets.set(0, 10, 0, 0);
|
||||||
|
|
||||||
displayPolicy.layoutWindowLw(mNavBarWindow, null, mDisplayContent.mDisplayFrames);
|
displayPolicy.layoutWindowLw(mImeWindow, null, mDisplayContent.mDisplayFrames);
|
||||||
final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState();
|
final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState();
|
||||||
final InsetsSource navBarSource = state.peekSource(
|
final InsetsSource imeSource = state.peekSource(ID_IME);
|
||||||
mNavBarWindow.getControllableInsetProvider().getSource().getId());
|
|
||||||
assertEquals(attrs.height - 10, navBarSource.getFrame().height());
|
assertNotNull(imeSource);
|
||||||
|
assertFalse(imeSource.getFrame().isEmpty());
|
||||||
|
assertEquals(mImeWindow.getWindowFrames().mFrame.height() - 10,
|
||||||
|
imeSource.getFrame().height());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SetupWindows(addWindows = { W_ACTIVITY, W_NAVIGATION_BAR })
|
@SetupWindows(addWindows = { W_ACTIVITY, W_NAVIGATION_BAR })
|
||||||
|
|||||||
@@ -75,25 +75,6 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
|
|||||||
mProvider.getSource().calculateVisibleInsets(new Rect(0, 0, 500, 500)));
|
mProvider.getSource().calculateVisibleInsets(new Rect(0, 0, 500, 500)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPostLayout_givenInsets() {
|
|
||||||
final WindowState ime = createWindow(null, TYPE_APPLICATION, "ime");
|
|
||||||
ime.getFrame().set(0, 0, 500, 100);
|
|
||||||
ime.mGivenContentInsets.set(0, 0, 0, 60);
|
|
||||||
ime.mGivenVisibleInsets.set(0, 0, 0, 75);
|
|
||||||
ime.mHasSurface = true;
|
|
||||||
mProvider.setWindowContainer(ime, null, null);
|
|
||||||
mProvider.updateSourceFrame(ime.getFrame());
|
|
||||||
mProvider.onPostLayout();
|
|
||||||
assertEquals(new Rect(0, 0, 500, 40), mProvider.getSource().getFrame());
|
|
||||||
assertEquals(new Rect(0, 0, 500, 25), mProvider.getSource().getVisibleFrame());
|
|
||||||
assertEquals(Insets.of(0, 40, 0, 0),
|
|
||||||
mProvider.getSource().calculateInsets(new Rect(0, 0, 500, 500),
|
|
||||||
false /* ignoreVisibility */));
|
|
||||||
assertEquals(Insets.of(0, 25, 0, 0),
|
|
||||||
mProvider.getSource().calculateVisibleInsets(new Rect(0, 0, 500, 500)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPostLayout_invisible() {
|
public void testPostLayout_invisible() {
|
||||||
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
||||||
|
|||||||
Reference in New Issue
Block a user