Track rotation and original frame in sizecompat

App bounds can be effected by resolved policy constraints.
In order to account for that, the app bounds are recorded
alongside the display properties. For orientation-locked
apps, the rotation is also locked so that resolve uses
the original rotation of the "compat" display for its
calculations.

In addition to this, it's possible for a size compat app
to change it's orientation at runtime, so this is handled
during onConfigurationChange.

The aspect ratio enforcement was also moved to resolve
phase because it's a policy constraint. This also makes it
responsive to configuration changes that don't go through
updateOverrideConfiguration.

Bug: 140060429
Bug: 138594779
Test: some manual + existing tests pass. More added in followup CL
Change-Id: If145323c86bc895d2125a5495d691c5db454a822
diff --git a/services/core/java/com/android/server/wm/TaskRecord.java b/services/core/java/com/android/server/wm/TaskRecord.java
index 09c25f0..463a445 100644
--- a/services/core/java/com/android/server/wm/TaskRecord.java
+++ b/services/core/java/com/android/server/wm/TaskRecord.java
@@ -2054,7 +2054,10 @@
             } else {
                 // Apply the given non-decor and stable insets to calculate the corresponding bounds
                 // for screen size of configuration.
-                final int rotation = parentConfig.windowConfiguration.getRotation();
+                int rotation = inOutConfig.windowConfiguration.getRotation();
+                if (rotation == ROTATION_UNDEFINED) {
+                    rotation = parentConfig.windowConfiguration.getRotation();
+                }
                 if (rotation != ROTATION_UNDEFINED && compatInsets != null) {
                     mTmpNonDecorBounds.set(bounds);
                     mTmpStableBounds.set(bounds);