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

Commit ccfa738a authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Android (Google) Code Review
Browse files

Merge "Use measure caches during force layout traversal" into main

parents c34e5869 8ba03525
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import static android.view.displayhash.DisplayHashResultCallback.EXTRA_DISPLAY_H
import static android.view.displayhash.DisplayHashResultCallback.EXTRA_DISPLAY_HASH_ERROR_CODE;
import static android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY;
import static android.view.flags.Flags.FLAG_VIEW_VELOCITY_API;
import static android.view.flags.Flags.enableUseMeasureCacheDuringForceLayout;
import static android.view.flags.Flags.toolkitMetricsForFrameRateDecision;
import static android.view.flags.Flags.toolkitSetFrameRateReadOnly;
import static android.view.flags.Flags.viewVelocityApi;
@@ -954,6 +955,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private static boolean sAlwaysRemeasureExactly = false;
    /**
     * When true makes it possible to use onMeasure caches also when the force layout flag is
     * enabled. This helps avoiding multiple measures in the same frame with the same dimensions.
     */
    private static boolean sUseMeasureCacheDuringForceLayoutFlagValue;
    /**
     * Allow setForeground/setBackground to be called (and ignored) on a textureview,
     * without throwing
@@ -2396,6 +2403,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        sToolkitSetFrameRateReadOnlyFlagValue = toolkitSetFrameRateReadOnly();
        sToolkitMetricsForFrameRateDecisionFlagValue = toolkitMetricsForFrameRateDecision();
        sUseMeasureCacheDuringForceLayoutFlagValue = enableUseMeasureCacheDuringForceLayout();
    }
    /**
@@ -27417,7 +27425,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            resolveRtlPropertiesIfNeeded();
            int cacheIndex = forceLayout ? -1 : mMeasureCache.indexOfKey(key);
            int cacheIndex;
            if (sUseMeasureCacheDuringForceLayoutFlagValue) {
                cacheIndex =  mMeasureCache.indexOfKey(key);
            } else {
                cacheIndex = forceLayout ? -1 : mMeasureCache.indexOfKey(key);
            }
            if (cacheIndex < 0 || sIgnoreMeasureCache) {
                if (isTraversalTracingEnabled()) {
                    Trace.beginSection(mTracingStrings.onMeasure);
+10 −0
Original line number Diff line number Diff line
package: "android.view.flags"

flag {
    name: "enable_use_measure_cache_during_force_layout"
    namespace: "toolkit"
    description: "Enables using the measure cache during a view force layout from the second "
      "onMeasure call onwards during the same traversal."
    bug: "316170253"
    is_fixed_read_only: true
}