Screenshots broken for activities with dialog themes

Makes progress towards fixing screenshots and transitions
for non-fullscreen activities.

Partially reverts I48053f551ed1c118764aa30e0b6408db64d4a5f1 and
applies it in a way that does not break screenshots in general.

Note that screenshots of non-fullscreen activities are still somewhat
broken because their insets can currently not be calculated correctly.

Bug: 72757033
Test: Open dialog activity, go to recents, verify it has a reasonable screenshot and smooth transition
Test: Open letterboxed activity, go to recents, verify it has a reasonable screenshot and smooth transition
Change-Id: Ica4d88370df00a91724d59b2cad6b27826beba04
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index c04522e..2672337 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1728,6 +1728,8 @@
                 frame.set(win.mContainingFrame);
             }
             surfaceInsets = win.getAttrs().surfaceInsets;
+            // XXX(b/72757033): These are insets relative to the window frame, but we're really
+            // interested in the insets relative to the frame we chose in the if-blocks above.
             insets.set(win.mContentInsets);
             stableInsets.set(win.mStableInsets);
         }
@@ -2120,4 +2122,12 @@
         }
         return stringName + ((mIsExiting) ? " mIsExiting=" : "");
     }
+
+    Rect getLetterboxInsets() {
+        if (mLetterbox != null) {
+            return mLetterbox.getInsets();
+        } else {
+            return new Rect();
+        }
+    }
 }