Prevent activity config override for system processes.

To improve app compatibility in multi-display and multi-window
environments WM overrides the process config with the config of the
most recently launched activity. However, doing so has caused issues with
system applications (notably System UI) who currently rely on this config.

This change ensures that system processes and system ui do not receive
this compatibility override and revert back to the old functionality. In
the future this will be replaced with dedicated channels to report
display configurations.

Test: WindowProcessControllerTests
Test: ActivityRecordTests

Bug: 148675523
Fixes: 148675523

Change-Id: I811d4f60c1e79b5526a5f9e9973b8d6355ee8c15
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 21d300a..7bacc42 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -356,6 +356,8 @@
     ActivityManagerInternal mAmInternal;
     UriGrantsManagerInternal mUgmInternal;
     private PackageManagerInternal mPmInternal;
+    /** The cached sys ui service component name from package manager. */
+    private ComponentName mSysUiServiceComponent;
     private PermissionPolicyInternal mPermissionPolicyInternal;
     @VisibleForTesting
     final ActivityTaskManagerInternal mInternal;
@@ -5869,6 +5871,14 @@
         return mPmInternal;
     }
 
+    ComponentName getSysUiServiceComponentLocked() {
+        if (mSysUiServiceComponent == null) {
+            final PackageManagerInternal pm = getPackageManagerInternalLocked();
+            mSysUiServiceComponent = pm.getSystemUiServiceComponent();
+        }
+        return mSysUiServiceComponent;
+    }
+
     PermissionPolicyInternal getPermissionPolicyInternal() {
         if (mPermissionPolicyInternal == null) {
             mPermissionPolicyInternal = LocalServices.getService(PermissionPolicyInternal.class);