Unregister configuration listener after the WindowProcessController
was disallowed to be overridden.

If the A11y or voice interaction service start after an activity,
the WindowProcessController's configuration was overridden by the activity.
After the mIsActivityConfigOverrideAllowed changed to false, and the activity
finished, the app's application and services will never receive new configuration.

Test: WindowProcessControllerTests
Test: ProcessRecordTests

Bug: 201457378
Change-Id: I971d7ff957a39447a477525e6a4924ddfb4bfa1c
diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java
index 1f8a437..d865ae4 100644
--- a/services/core/java/com/android/server/wm/WindowProcessController.java
+++ b/services/core/java/com/android/server/wm/WindowProcessController.java
@@ -1414,7 +1414,9 @@
                 // activity as it could lead to incorrect display metrics. For ex, IME services
                 // expect their config to match the config of the display with the IME window
                 // showing.
+                // If the configuration has been overridden by previous activity, empty it.
                 mIsActivityConfigOverrideAllowed = false;
+                unregisterActivityConfigurationListener();
                 break;
             default:
                 break;