Do not override insets frame if not set
Only set imeFrameProvider if the value is set in the base layout params. This will improve the performance as the null provider can be skipped, in the meanwhile, it will fix an error where the ime frame is accidentally overridden. Test: KeyboardVisibilityControlTest (CTS, on auto builds) Bug: 229346670 Change-Id: Iaf6298e81c92b8dd221cae79e6391799b8023e95
This commit is contained in:
@@ -1190,7 +1190,8 @@ public class DisplayPolicy {
|
||||
if (attrs.providesInsetsTypes != null) {
|
||||
for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) {
|
||||
final TriConsumer<DisplayFrames, WindowContainer, Rect> imeFrameProvider =
|
||||
(displayFrames, windowContainer, inOutFrame) -> {
|
||||
win.getAttrs().providedInternalImeInsets != null
|
||||
? (displayFrames, windowContainer, inOutFrame) -> {
|
||||
final Insets[] providedInternalImeInsets =
|
||||
win.getLayoutingAttrs(displayFrames.mRotation)
|
||||
.providedInternalImeInsets;
|
||||
@@ -1199,7 +1200,7 @@ public class DisplayPolicy {
|
||||
&& providedInternalImeInsets[insetsType] != null) {
|
||||
inOutFrame.inset(providedInternalImeInsets[insetsType]);
|
||||
}
|
||||
};
|
||||
} : null;
|
||||
switch (insetsType) {
|
||||
case ITYPE_STATUS_BAR:
|
||||
mStatusBarAlt = win;
|
||||
@@ -1218,17 +1219,18 @@ public class DisplayPolicy {
|
||||
mExtraNavBarAltPosition = getAltBarPosition(attrs);
|
||||
break;
|
||||
}
|
||||
mDisplayContent.setInsetProvider(insetsType, win, (displayFrames,
|
||||
windowContainer, inOutFrame) -> {
|
||||
final Insets[] providedInternalInsets = win.getLayoutingAttrs(
|
||||
displayFrames.mRotation).providedInternalInsets;
|
||||
if (providedInternalInsets != null
|
||||
&& providedInternalInsets.length > insetsType
|
||||
&& providedInternalInsets[insetsType] != null) {
|
||||
inOutFrame.inset(providedInternalInsets[insetsType]);
|
||||
}
|
||||
inOutFrame.inset(win.mGivenContentInsets);
|
||||
}, imeFrameProvider);
|
||||
mDisplayContent.setInsetProvider(insetsType, win,
|
||||
win.getAttrs().providedInternalInsets != null ? (displayFrames,
|
||||
windowContainer, inOutFrame) -> {
|
||||
final Insets[] providedInternalInsets = win.getLayoutingAttrs(
|
||||
displayFrames.mRotation).providedInternalInsets;
|
||||
if (providedInternalInsets != null
|
||||
&& providedInternalInsets.length > insetsType
|
||||
&& providedInternalInsets[insetsType] != null) {
|
||||
inOutFrame.inset(providedInternalInsets[insetsType]);
|
||||
}
|
||||
inOutFrame.inset(win.mGivenContentInsets);
|
||||
} : null, imeFrameProvider);
|
||||
mInsetsSourceWindowsExceptIme.add(win);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user