Override process config to match activity config

Some apps use Application context to get display configuration and
metrics for their activities. This leads to incorrect configuration
used for activities on secondary screens. This is an issue on the
application side, but the framework can provide some compatibility -
override process-level config to match the display where the first
activity was launched.

This CL makes the process follow the activity configuration.
For simplicity, it will always follow the configuration of the
activity that was last added to the process. Additional optimizations
might be added in future.

This CL also adds new merged override configuration listener
interface to report the combined config overrides from the current
node and its parents. This is necessary for cases like sending
a config override to WindowProcessController, when the subscriber is
interested in a complete override vs the override on the current
level of the hierarchy. E.g. when an Activity is registered as a
config override provider for WPC, then we should also send the
overrides from Task, Stack and Display levels.

Bug: 131179060
Bug: 132986140
Bug: 131915789
Test: atest WmTests:ActivityRecordTests#testSetProcessOverridesConfig
Test: Launch GMail on secondary screen
Change-Id: I5c4342646858a77aeebc274265aab41dc753fbca
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index ded603c..ea7a62a 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -248,7 +248,6 @@
 import com.android.internal.policy.KeyguardDismissCallback;
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.FastPrintWriter;
-import com.android.internal.util.Preconditions;
 import com.android.internal.util.function.pooled.PooledConsumer;
 import com.android.internal.util.function.pooled.PooledFunction;
 import com.android.internal.util.function.pooled.PooledLambda;
@@ -6697,7 +6696,7 @@
                     return;
                 }
                 process.mIsImeProcess = true;
-                process.registerDisplayConfigurationListenerLocked(displayContent);
+                process.registerDisplayConfigurationListener(displayContent);
             }
         }