From 77a0bd889978e4b9945f146ce7fac212ff0540ef Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Thu, 24 Nov 2022 17:02:28 +0900 Subject: [PATCH] Remove the usage of givenContentInsets for non-IME windows Currently, no insets is calculated based on contentInsets and other fields set in WindowState when the InsetsFrameProvider is given. It is safe to remove the calculation for windows other than IME. The fields in WindowState, including touchableAreaInsets, visibleInsets, contentInsets is a description of the window itself, instead of the insets it providing to other windows. Such that, we can remove the consideration of those fields for most cases. Bug: 202360061 Test: DisplayPolicyInsetsTests Change-Id: Ie127f4655ed923545dede16ebc615dbf8384d34a --- core/java/android/view/InsetsFrameProvider.java | 4 ++++ services/core/java/com/android/server/wm/DisplayPolicy.java | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/InsetsFrameProvider.java b/core/java/android/view/InsetsFrameProvider.java index da54da16585d6..58ee59d1b36bf 100644 --- a/core/java/android/view/InsetsFrameProvider.java +++ b/core/java/android/view/InsetsFrameProvider.java @@ -31,6 +31,10 @@ import java.util.Objects; * * The insets frame will by default as the window frame size. If the providers are set, the * calculation result based on the source size will be used as the insets frame. + * + * The InsetsFrameProvider should be self-contained. Nothing describing the window itself, such as + * contentInsets, visibleInsets, etc. won't affect the insets providing to other windows when this + * is set. * @hide */ public class InsetsFrameProvider implements Parcelable { diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 87239944fa609..0db032b9806ed 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1203,7 +1203,6 @@ public class DisplayPolicy { return null; } return (displayFrames, windowContainer, inOutFrame) -> { - inOutFrame.inset(win.mGivenContentInsets); final LayoutParams lp = win.mAttrs.forRotation(displayFrames.mRotation); final InsetsFrameProvider ifp = lp.providedInsets[index]; InsetsFrameProvider.calculateInsetsFrame(displayFrames.mUnrestricted,