Loading core/java/android/view/View.java +15 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -2396,6 +2403,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, sToolkitSetFrameRateReadOnlyFlagValue = toolkitSetFrameRateReadOnly(); sToolkitMetricsForFrameRateDecisionFlagValue = toolkitMetricsForFrameRateDecision(); sUseMeasureCacheDuringForceLayoutFlagValue = enableUseMeasureCacheDuringForceLayout(); } /** Loading Loading @@ -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); core/java/android/view/flags/view_flags.aconfig 0 → 100644 +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 } Loading
core/java/android/view/View.java +15 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -2396,6 +2403,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, sToolkitSetFrameRateReadOnlyFlagValue = toolkitSetFrameRateReadOnly(); sToolkitMetricsForFrameRateDecisionFlagValue = toolkitMetricsForFrameRateDecision(); sUseMeasureCacheDuringForceLayoutFlagValue = enableUseMeasureCacheDuringForceLayout(); } /** Loading Loading @@ -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);
core/java/android/view/flags/view_flags.aconfig 0 → 100644 +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 }