WindowManager: Reapply magnification spec when adding windows.

Previously the magnification spec was effectively reapplied on each
frame when preparing surfaces. Following the migration to the hierarchy
it was thought this wasn't needed since parent hierarchy layers
would be magnified and Surfaces would receive them as they came and went.
It didn't end up quite so hunky-dory. While the app layer is magnified in whole,
the non app layer relies on magnification of individual windows to avoid magnifying
the navigation bar. Simply put this means we need to reapply magnification
when adding windows in addition to when the magnification spec changes.

Bug: 74221620
Test: Manual
Change-Id: Ifd17ecc837a9aa611ddc29e87aa95d2854b2af8e
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 38fb30e..9621edd 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -393,6 +393,8 @@
     /** Temporary float array to retrieve 3x3 matrix values. */
     private final float[] mTmpFloats = new float[9];
 
+    private MagnificationSpec mMagnificationSpec;
+
     private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
         WindowStateAnimator winAnimator = w.mWinAnimator;
         final AppWindowToken atoken = w.mAppToken;
@@ -3837,10 +3839,22 @@
     }
 
     void applyMagnificationSpec(MagnificationSpec spec) {
+        if (spec.scale != 1.0) {
+            mMagnificationSpec = spec;
+        } else {
+            mMagnificationSpec = null;
+        }
+
         applyMagnificationSpec(getPendingTransaction(), spec);
         getPendingTransaction().apply();
     }
 
+    void reapplyMagnificationSpec() {
+        if (mMagnificationSpec != null) {
+            applyMagnificationSpec(getPendingTransaction(), mMagnificationSpec);
+        }
+    }
+
     @Override
     void onParentSet() {
         // Since we are the top of the SurfaceControl hierarchy here