Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 482f7248 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Revert "Remove enabled flag reduce_unnecessary_measure"

This reverts commit cf359393.

Reason for revert: b/427387594
Bug: 427387594

Change-Id: I55dc8500e46aed6868781fbece7c2344a5f352c0
parent cf359393
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FIT_INSETS_CO
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;
@@ -3508,6 +3509,14 @@ public final class ViewRootImpl implements ViewParent,
                || 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) {
        return (lp.privateFlags & PRIVATE_FLAG_OPTIMIZE_MEASURE) != 0;
    }
    private Rect getWindowBoundsInsetSystemBars() {
        final Rect bounds = new Rect(
                mContext.getResources().getConfiguration().windowConfiguration.getBounds());
@@ -3572,6 +3581,7 @@ public final class ViewRootImpl implements ViewParent,
        mAppVisibilityChanged = false;
        final boolean viewUserVisibilityChanged = !mFirst &&
                ((mViewVisibility == View.VISIBLE) != (viewVisibility == View.VISIBLE));
        final boolean shouldOptimizeMeasure = shouldOptimizeMeasure(lp);
        WindowManager.LayoutParams params = null;
        Rect frame = mWinFrame;
@@ -3696,7 +3706,7 @@ public final class ViewRootImpl implements ViewParent,
            // Ask host how big it wants to be
            windowSizeMayChange |= measureHierarchy(host, lp, mView.getContext().getResources(),
                    desiredWindowWidth, desiredWindowHeight, true /* forRootSizeOnly */);
                    desiredWindowWidth, desiredWindowHeight, shouldOptimizeMeasure);
        }
        if (collectViewAttributes()) {
@@ -3737,7 +3747,7 @@ public final class ViewRootImpl implements ViewParent,
                // change due to fitting system windows, which can happen a lot.
                windowSizeMayChange |= measureHierarchy(host, lp,
                        mView.getContext().getResources(), desiredWindowWidth, desiredWindowHeight,
                        true /* forRootSizeOnly */);
                        shouldOptimizeMeasure);
            }
        }