Merge "Do not override insets frame if not set" into tm-dev

This commit is contained in:
Yunfan Chen
2022-05-13 05:46:37 +00:00
committed by Android (Google) Code Review

View File

@@ -1190,7 +1190,8 @@ public class DisplayPolicy {
if (attrs.providesInsetsTypes != null) { if (attrs.providesInsetsTypes != null) {
for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) { for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) {
final TriConsumer<DisplayFrames, WindowContainer, Rect> imeFrameProvider = final TriConsumer<DisplayFrames, WindowContainer, Rect> imeFrameProvider =
(displayFrames, windowContainer, inOutFrame) -> { win.getAttrs().providedInternalImeInsets != null
? (displayFrames, windowContainer, inOutFrame) -> {
final Insets[] providedInternalImeInsets = final Insets[] providedInternalImeInsets =
win.getLayoutingAttrs(displayFrames.mRotation) win.getLayoutingAttrs(displayFrames.mRotation)
.providedInternalImeInsets; .providedInternalImeInsets;
@@ -1199,7 +1200,7 @@ public class DisplayPolicy {
&& providedInternalImeInsets[insetsType] != null) { && providedInternalImeInsets[insetsType] != null) {
inOutFrame.inset(providedInternalImeInsets[insetsType]); inOutFrame.inset(providedInternalImeInsets[insetsType]);
} }
}; } : null;
switch (insetsType) { switch (insetsType) {
case ITYPE_STATUS_BAR: case ITYPE_STATUS_BAR:
mStatusBarAlt = win; mStatusBarAlt = win;
@@ -1218,17 +1219,18 @@ public class DisplayPolicy {
mExtraNavBarAltPosition = getAltBarPosition(attrs); mExtraNavBarAltPosition = getAltBarPosition(attrs);
break; break;
} }
mDisplayContent.setInsetProvider(insetsType, win, (displayFrames, mDisplayContent.setInsetProvider(insetsType, win,
windowContainer, inOutFrame) -> { win.getAttrs().providedInternalInsets != null ? (displayFrames,
final Insets[] providedInternalInsets = win.getLayoutingAttrs( windowContainer, inOutFrame) -> {
displayFrames.mRotation).providedInternalInsets; final Insets[] providedInternalInsets = win.getLayoutingAttrs(
if (providedInternalInsets != null displayFrames.mRotation).providedInternalInsets;
&& providedInternalInsets.length > insetsType if (providedInternalInsets != null
&& providedInternalInsets[insetsType] != null) { && providedInternalInsets.length > insetsType
inOutFrame.inset(providedInternalInsets[insetsType]); && providedInternalInsets[insetsType] != null) {
} inOutFrame.inset(providedInternalInsets[insetsType]);
inOutFrame.inset(win.mGivenContentInsets); }
}, imeFrameProvider); inOutFrame.inset(win.mGivenContentInsets);
} : null, imeFrameProvider);
mInsetsSourceWindowsExceptIme.add(win); mInsetsSourceWindowsExceptIme.add(win);
} }
} }