Remove enabled flag reduce_unnecessary_measure

Bug: 419312922
Flag: EXEMPT flag removal
Test: CtsWindowManagerDeviceWindow
Change-Id: I765d019e7ac4e60408ebdd308116ee45275349a0

diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 58e53c8..9484a80 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -98,7 +98,6 @@
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INSET_PARENT_FRAME_BY_IME;
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE;
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OVERRIDE_LAYOUT_IN_DISPLAY_CUTOUT_MODE;
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_APPLICATION_OVERLAY;
 import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
@@ -3509,17 +3508,6 @@
                 || lp.type == TYPE_VOLUME_OVERLAY;
     }
 
-    /**
-     * @return {@code true} if we should reduce unnecessary measure for the window.
-     * TODO(b/260382739): Apply this to all windows.
-     */
-    private static boolean shouldOptimizeMeasure(final WindowManager.LayoutParams lp) {
-        if (com.android.window.flags.Flags.reduceUnnecessaryMeasure()) {
-            return true;
-        }
-        return (lp.privateFlags & PRIVATE_FLAG_OPTIMIZE_MEASURE) != 0;
-    }
-
     private Rect getWindowBoundsInsetSystemBars() {
         final Rect bounds = new Rect(
                 mContext.getResources().getConfiguration().windowConfiguration.getBounds());
@@ -3584,7 +3572,6 @@
         mAppVisibilityChanged = false;
         final boolean viewUserVisibilityChanged = !mFirst &&
                 ((mViewVisibility == View.VISIBLE) != (viewVisibility == View.VISIBLE));
-        final boolean shouldOptimizeMeasure = shouldOptimizeMeasure(lp);
 
         WindowManager.LayoutParams params = null;
         Rect frame = mWinFrame;
@@ -3709,7 +3696,7 @@
 
             // Ask host how big it wants to be
             windowSizeMayChange |= measureHierarchy(host, lp, mView.getContext().getResources(),
-                    desiredWindowWidth, desiredWindowHeight, shouldOptimizeMeasure);
+                    desiredWindowWidth, desiredWindowHeight, true /* forRootSizeOnly */);
         }
 
         if (collectViewAttributes()) {
@@ -3750,7 +3737,7 @@
                 // change due to fitting system windows, which can happen a lot.
                 windowSizeMayChange |= measureHierarchy(host, lp,
                         mView.getContext().getResources(), desiredWindowWidth, desiredWindowHeight,
-                        shouldOptimizeMeasure);
+                        true /* forRootSizeOnly */);
             }
         }
 
diff --git a/core/java/android/window/flags/windowing_frontend.aconfig b/core/java/android/window/flags/windowing_frontend.aconfig
index e06f9f1..e10557a 100644
--- a/core/java/android/window/flags/windowing_frontend.aconfig
+++ b/core/java/android/window/flags/windowing_frontend.aconfig
@@ -247,17 +247,6 @@
 }
 
 flag {
-  name: "reduce_unnecessary_measure"
-  namespace: "windowing_frontend"
-  description: "Skip measuring view hierarchy if the size is known"
-  bug: "260382739"
-  is_fixed_read_only: true
-  metadata {
-    purpose: PURPOSE_BUGFIX
-  }
-}
-
-flag {
   name: "ensure_keyguard_does_transition_starting"
   namespace: "windowing_frontend"
   description: "Ensure that keyguard is the one starting transitions, instead of delegating to Core"