Clear cached override frame when window removed

When removing a window, the corresponding WindowContainer of a
InsetsSourceProvider will be set to null, instead of directly removing
the provider. We need to clear all recorded information, including the
override frames to make sure the removal in effect to all windows.

Test: See b/252455307
Bug: 252455307
Change-Id: I2e59485fdf25af743afe918525ed5e6872e6fff7
This commit is contained in:
Yunfan Chen
2022-10-13 17:09:36 +09:00
parent 4d80e6f409
commit 463bf0cd08

View File

@@ -173,6 +173,7 @@ abstract class InsetsSourceProvider {
mWindowContainer = windowContainer;
// TODO: remove the frame provider for non-WindowState container.
mFrameProvider = frameProvider;
mOverrideFrames.clear();
mOverrideFrameProviders = overrideFrameProviders;
if (windowContainer == null) {
setServerVisible(false);
@@ -234,6 +235,8 @@ abstract class InsetsSourceProvider {
updateSourceFrameForServerVisibility();
if (mOverrideFrameProviders != null) {
// Not necessary to clear the mOverrideFrames here. It will be cleared every time the
// override frame provider updates.
for (int i = mOverrideFrameProviders.size() - 1; i >= 0; i--) {
final int windowType = mOverrideFrameProviders.keyAt(i);
final Rect overrideFrame;