Merge "Don't add insets when a container is detached" into tm-qpr-dev am: 82a9156b14

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19246352

Change-Id: I1e731664e6cfbb5fcedaf3ad141f9cb9334d751b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-07-14 17:48:54 +00:00
committed by Automerger Merge Worker

View File

@@ -429,6 +429,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
if (insetsTypes == null || insetsTypes.length == 0) { if (insetsTypes == null || insetsTypes.length == 0) {
throw new IllegalArgumentException("Insets type not specified."); throw new IllegalArgumentException("Insets type not specified.");
} }
if (mDisplayContent == null) {
// This is possible this container is detached when WM shell is responding to a previous
// request. WM shell will be updated when this container is attached again and the
// insets need to be updated.
Slog.w(TAG, "Can't add local rect insets source provider when detached. " + this);
return;
}
if (mLocalInsetsSourceProviders == null) { if (mLocalInsetsSourceProviders == null) {
mLocalInsetsSourceProviders = new SparseArray<>(); mLocalInsetsSourceProviders = new SparseArray<>();
} }
@@ -1011,6 +1018,9 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
if (dc != null && dc != this) { if (dc != null && dc != this) {
dc.getPendingTransaction().merge(mPendingTransaction); dc.getPendingTransaction().merge(mPendingTransaction);
} }
if (dc != this && mLocalInsetsSourceProviders != null) {
mLocalInsetsSourceProviders.clear();
}
for (int i = mChildren.size() - 1; i >= 0; --i) { for (int i = mChildren.size() - 1; i >= 0; --i) {
final WindowContainer child = mChildren.get(i); final WindowContainer child = mChildren.get(i);
child.onDisplayChanged(dc); child.onDisplayChanged(dc);