Reset configuration of invisible size-compat activity if display changes

Assume a size compatibility mode activity is moved to another display,
and then it is put in background. In this case, if the size or density
of display is changed, the existing override configuration (by previous
display) will be reset and also kill its process if the process state
is not important to user (also sync the state criteria to pre-N app).
So when the activity becomes the foreground again, it will have a new
process with the latest configuration.

Bug: 112288258
Fixes: 125587591
Test: atest ActivityRecordTests#testSizeCompatMode_ResetNonVisibleActivity

Change-Id: I14c90b6a7bb00eeb66d2b9f2d8e85ccfa9ef4e51
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 118eb5b..b3b4cbe 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -5209,7 +5209,7 @@
                 // the ATMS lock held.
                 final Message msg = PooledLambda.obtainMessage(
                         ActivityManagerInternal::killAllBackgroundProcessesExcept, mAmInternal,
-                        N, ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE);
+                        N, ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND);
                 mH.sendMessage(msg);
             }
         }