ComposeFoundationFlags
-
Cmn
@ExperimentalFoundationApi
object ComposeFoundationFlags
This is a collection of flags which are used to guard against regressions in some of the "riskier" refactors or new feature support that is added to this module. These flags are always "on" in the published artifact of this module, however these flags allow end consumers of this module to toggle them "off" in case this new path is causing a regression.
These flags are considered temporary, and there should be no expectation for these flags be around for an extended period of time. If you have a regression that one of these flags fixes, it is strongly encouraged for you to file a bug ASAP.
Usage:
In order to turn a feature off in a debug environment, it is recommended to set this to false in as close to the initial loading of the application as possible. Changing this value after compose library code has already been loaded can result in undefined behavior.
class MyApplication : Application() { override fun onCreate() { ComposeFoundationFlags.SomeFeatureEnabled = false super.onCreate() } }
In order to turn this off in a release environment, it is recommended to additionally utilize R8 rules which force a single value for the entire build artifact. This can result in the new code paths being completely removed from the artifact, which can often have nontrivial positive performance impact.
-assumevalues class androidx.compose.foundation.ComposeFoundationFlags { public static boolean SomeFeatureEnabled return false }
Summary
Public properties |
||
|---|---|---|
Boolean |
With this flag enabled, |
Cmn
|
Boolean |
This flag controls performance optimizations related to |
Cmn
|
Boolean |
This flag controls performance optimizations related to |
Cmn
|
Boolean |
This flag controls performance optimizations related to squashing multiple modifiers responsible for providing default measurement of the |
Cmn
|
Boolean |
This flag controls whether |
Cmn
|
Boolean |
With this flag on, Pager will use |
Cmn
|
Boolean |
This flag controls whether |
Cmn
|
Boolean |
This flag controls whether the legacy nodeOffset logic in DragGestureNode and IndirectPointerInputDragCycleDetector is disabled. |
Cmn
|
Boolean |
This flag controls the fix where we prioritize consumption on initial pass in Draggable. |
Cmn
|
Boolean |
This flag controls whether the fix for velocity tracker usage in Draggable and related classes is enabled to a) properly track velocity per pointer and b) make sure to also take the pointer events into account that don't move at the beginning of the gesture in order to increase the stability of the computed velocity. |
Cmn
|
Boolean |
This flag controls the fix where draggable was ignoring and not consuming zero delta events. |
Cmn
|
Boolean |
Whether to support inherited text styles. |
Cmn
|
Boolean |
This flag controls whether |
Cmn
|
Boolean |
This flag controls whether lazy list measure passes calculate |
Cmn
|
Boolean |
Disable minimum touch target expansion for inline links. |
Cmn
|
Boolean |
This flag controls whether it's possible to start selecting (via the mouse) text in a |
Cmn
|
Boolean |
With this flag on, |
Cmn
|
Boolean |
Whether to use the new context menu API and default implementations in |
Cmn
|
Boolean |
This flag controls whether |
Cmn
|
Boolean |
This flag controls whether |
Cmn
|
Boolean |
This flag controls the fix where we correctly dispatch deltas in pager's default pageNestedScrollConnection by considering the role of reverse layout. |
Cmn
|
Boolean |
This flag controls whether selecting text in |
Cmn
|
Boolean |
Whether to use the new smart selection feature in |
Cmn
|
Boolean |
With this flag enabled, |
Cmn
|
Boolean |
Controls whether |
Cmn
|
Boolean |
Controls whether |
Cmn
|
Boolean |
Controls whether |
Cmn
|
Public properties
isAnchoredDraggableTargetValueCalculationFixEnabled
var isAnchoredDraggableTargetValueCalculationFixEnabled: Boolean
With this flag enabled, androidx.compose.foundation.gestures.AnchoredDraggableState.targetValue correctly returns the androidx.compose.foundation.gestures.AnchoredDraggableState.currentValue when no androidx.compose.foundation.gestures.AnchoredDraggableState.anchoredDrag is in progress. Previously, androidx.compose.foundation.gestures.AnchoredDraggableState.targetValue incorrectly returned the last-inserted anchor when there were two or more anchors with the same offset, for example: DraggableAnchors { Expanded at 100f; HalfExpanded at 0f; Hidden at 0f;} Disabling the flag restores this previous behavior.
isBasicTextFieldHeightInLinesOptimizationEnabled
var isBasicTextFieldHeightInLinesOptimizationEnabled: Boolean
This flag controls performance optimizations related to androidx.compose.foundation.text.BasicTextField's internal calculations of the minimum and maximum height.
isBasicTextFieldMinSizeOptimizationEnabled
var isBasicTextFieldMinSizeOptimizationEnabled: Boolean
This flag controls performance optimizations related to androidx.compose.foundation.text.BasicTextField's internal min height calculations.
isBasicTextFieldSizeOptimizationEnabled
var isBasicTextFieldSizeOptimizationEnabled: Boolean
This flag controls performance optimizations related to squashing multiple modifiers responsible for providing default measurement of the androidx.compose.foundation.text.BasicTextField into one.
isBasicTextFieldStyledTextEnabled
var isBasicTextFieldStyledTextEnabled: Boolean
This flag controls whether androidx.compose.foundation.text.BasicTextField's formatted text features are enabled.
isCacheWindowForPagerEnabled
var isCacheWindowForPagerEnabled: Boolean
With this flag on, Pager will use androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow as the default prefetching strategy, instead of 1 item in the direction of the scroll. The window used will be 1 view port AFTER the currently composed items, this includes visible and items composed through beyond bounds.
isCacheWindowLookaheadCheckEnabled
var isCacheWindowLookaheadCheckEnabled: Boolean
This flag controls whether androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow checks if the number of visible items has changed across iterations without scroll deltas (such as when changing lookahead window sizes) and refills the cache window if needed.
isDragNodeOffsetDoubleCountingFixEnabled
var isDragNodeOffsetDoubleCountingFixEnabled: Boolean
This flag controls whether the legacy nodeOffset logic in DragGestureNode and IndirectPointerInputDragCycleDetector is disabled. Previously, VelocityTracker used local coordinates, necessitating manual point adjustment tracking.
isDraggableInitialPassConsumptionFixEnabled
var isDraggableInitialPassConsumptionFixEnabled: Boolean
This flag controls the fix where we prioritize consumption on initial pass in Draggable. If a drag gesture started immediately, it should block subsequent nested gestures because the initial down was consumed.
isDraggableVelocityTrackerFixEnabled
var isDraggableVelocityTrackerFixEnabled: Boolean
This flag controls whether the fix for velocity tracker usage in Draggable and related classes is enabled to a) properly track velocity per pointer and b) make sure to also take the pointer events into account that don't move at the beginning of the gesture in order to increase the stability of the computed velocity.
isDraggableZeroDeltaConsumptionEnabled
var isDraggableZeroDeltaConsumptionEnabled: Boolean
This flag controls the fix where draggable was ignoring and not consuming zero delta events. This caused issues with the gesture pickup feature. When this flag is enabled, zero delta events will be consumed (after a drag gesture has started).
isInheritedTextStyleEnabled
var isInheritedTextStyleEnabled: Boolean
Whether to support inherited text styles. If enabled, text styles set by the styles API will be inherited by text composables contained in a style box.
isKeepAroundDuringLookaheadDisabled
var isKeepAroundDuringLookaheadDisabled: Boolean
This flag controls whether androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow only executes keepAroundItems during non-lookahead (approach) measure passes in androidx.compose.foundation.lazy.LazyList, androidx.compose.foundation.lazy.grid.LazyGrid, and androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGrid.
isLazyListItemAnimatorVisibleBoundsFixEnabled
var isLazyListItemAnimatorVisibleBoundsFixEnabled: Boolean
This flag controls whether lazy list measure passes calculate firstVisibleIndex and lastVisibleIndex from layout visible items before item placement animations run, preventing moving-away items added by androidx.compose.foundation.lazy.layout.LazyLayoutItemAnimator from corrupting visible item bounds and causing unwanted composition in prefetch or cache window strategies.
isLinkMinimumTouchTargetSizeZeroEnabled
var isLinkMinimumTouchTargetSizeZeroEnabled: Boolean
Disable minimum touch target expansion for inline links. Touch target expansion for multi-line links causes incorrect clicks on plain text on the same lines because it uses layout bounds (bounding box of multi-line path) instead of clipped shape.
isMouseSelectionBetweenTextEnabled
var isMouseSelectionBetweenTextEnabled: Boolean
This flag controls whether it's possible to start selecting (via the mouse) text in a androidx.compose.foundation.text.selection.SelectionContainer by dragging from the areas between the text selectables.
isMultiLaneCacheWindowEnabled
var isMultiLaneCacheWindowEnabled: Boolean
With this flag on, androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow will support multi-lane configurations.
isNewContextMenuEnabled
var isNewContextMenuEnabled: Boolean
Whether to use the new context menu API and default implementations in SelectionContainer, and all BasicTextFields. If false, the previous context menu that has no public APIs will be used instead.
isPreferDefaultCacheWindowOverPrefetchStrategyLazyGrid
var isPreferDefaultCacheWindowOverPrefetchStrategyLazyGrid: Boolean
This flag controls whether androidx.compose.foundation.lazy.grid.LazyGrid prefers using the default androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow over androidx.compose.foundation.lazy.grid.LazyGridPrefetchStrategy.
isPreferDefaultCacheWindowOverPrefetchStrategyLazyList
var isPreferDefaultCacheWindowOverPrefetchStrategyLazyList: Boolean
This flag controls whether androidx.compose.foundation.lazy.LazyList prefers using the default androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow over androidx.compose.foundation.lazy.LazyListPrefetchStrategy.
isReverseLayoutNestedScrollConnectionInPagerFixEnabled
var isReverseLayoutNestedScrollConnectionInPagerFixEnabled: Boolean
This flag controls the fix where we correctly dispatch deltas in pager's default pageNestedScrollConnection by considering the role of reverse layout.
isSelectionAutoScrollEnabled
var isSelectionAutoScrollEnabled: Boolean
This flag controls whether selecting text in androidx.compose.foundation.text.selection.SelectionContainer causes scrollable ancestors of the text to be scrolled when the selecting pointer is dragged outside the scrollable's viewport.
isSmartSelectionEnabled
var isSmartSelectionEnabled: Boolean
Whether to use the new smart selection feature in androidx.compose.foundation.text.selection.SelectionContainer and all androidx.compose.foundation.text.BasicTextFields.
isUsingCacheWindowInStaggeredGrids
var isUsingCacheWindowInStaggeredGrids: Boolean
With this flag enabled, androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGrid layouts will make use of a cache window, either a default cache window or the cache window provided by the user via the composable function arguments.
isUsingDynamicDefaultCacheWindowInGrids
var isUsingDynamicDefaultCacheWindowInGrids: Boolean
Controls whether androidx.compose.foundation.lazy.grid.LazyVerticalGrid and androidx.compose.foundation.lazy.grid.LazyHorizontalGrid use a dynamic default cache window.
When enabled, the ahead androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow size dynamically adapts to the average main axis size of visible lines, bounded between 10% and 50% of the viewport, rather than using a static viewport fraction.
isUsingDynamicDefaultCacheWindowInLists
var isUsingDynamicDefaultCacheWindowInLists: Boolean
Controls whether androidx.compose.foundation.lazy.LazyColumn and androidx.compose.foundation.lazy.LazyRow use a dynamic default cache window.
When enabled, the ahead androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow size dynamically adapts to the average size of visible items, bounded between 10% and 50% of the viewport, rather than using a static viewport fraction.
isUsingDynamicDefaultCacheWindowInStaggeredGrids
var isUsingDynamicDefaultCacheWindowInStaggeredGrids: Boolean
Controls whether androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid and androidx.compose.foundation.lazy.staggeredgrid.LazyHorizontalStaggeredGrid use a dynamic default cache window.
When enabled, the ahead androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow size dynamically adapts to the average size of visible items, bounded between 10% and 50% of the viewport, rather than using a static viewport fraction.