Unregister configuration listener when remove container
AppWindowToken and Task are registered as configuration change listener
while creating. We need to unregister them when get removed. The
unregistration was a part of the removed window container controllers.
Test: atest WmTests
Test: go/wm-smoke
Bug: 80414790
Change-Id: Ic33ca9aafb14d39c32b4b8015cdb6eccf04d9562
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 69d9810..b10fd31 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -201,6 +201,9 @@
if (DEBUG_STACK) Slog.i(TAG, "removeTask: removing taskId=" + mTaskId);
EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "removeTask");
mDeferRemoval = false;
+ if (mTaskRecord != null) {
+ mTaskRecord.unregisterConfigurationChangeListener(this);
+ }
super.removeImmediately();
}