Restrict ime adjustment to maintain primary split visibility

This does a few things.

1. Fixes the logic around restricting the amount of adjustment. Its
   supposed to make sure that at-least 1/3 of the primary split is
   visible.

2. Fixes an issue where windowcontainertransactions weren't applying
   configuration updates to tiles specifically

3. Includes configuration changes among the things that will send
   onTaskInfoChanged updates to task-organizers. Previously, the
   changes were actually applied late.
   - The reported changes are restricted to only configs that
     task organizers can set.

4. To adapt to config changes being reported, divider code needed
   to be changed.

Bug: 151181674
Test: Using various snaps of split, open ime in secondary and
      verify that primary remains visible.
Change-Id: I7001bd29872a15950f91ab2407848fde8c3f1d02
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java
index 48ea4ae..f1bb27a 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java
@@ -30,7 +30,6 @@
 import android.util.Log;
 import android.view.Display;
 import android.view.ITaskOrganizer;
-import android.view.IWindowContainer;
 import android.view.SurfaceControl;
 import android.view.SurfaceSession;
 
@@ -108,6 +107,8 @@
      * presentations based on the contents of the split regions.
      */
     private void handleTaskInfoChanged(RunningTaskInfo info) {
+        final boolean secondaryWasHomeOrRecents = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
+                || mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
         final boolean primaryWasEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
         final boolean secondaryWasEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
         if (info.token.asBinder() == mPrimary.token.asBinder()) {
@@ -117,9 +118,16 @@
         }
         final boolean primaryIsEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
         final boolean secondaryIsEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
+        final boolean secondaryIsHomeOrRecents = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
+                || mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
         if (DEBUG) {
             Log.d(TAG, "onTaskInfoChanged " + mPrimary + "  " + mSecondary);
         }
+        if (primaryIsEmpty == primaryWasEmpty && secondaryWasEmpty == secondaryIsEmpty
+                && secondaryWasHomeOrRecents == secondaryIsHomeOrRecents) {
+            // No relevant changes
+            return;
+        }
         if (primaryIsEmpty || secondaryIsEmpty) {
             // At-least one of the splits is empty which means we are currently transitioning
             // into or out-of split-screen mode.
@@ -146,8 +154,7 @@
                 }
                 mDivider.startEnterSplit();
             }
-        } else if (mSecondary.topActivityType == ACTIVITY_TYPE_HOME
-                || mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS) {
+        } else if (secondaryIsHomeOrRecents) {
             // Both splits are populated but the secondary split has a home/recents stack on top,
             // so enter minimized mode.
             mDivider.ensureMinimizedSplit();