@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 }
Properties
@JvmField var isNewContextMenuEnabled = true
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.
@JvmField var isSmartSelectionEnabled = true
Whether to use the new smart selection feature in androidx.compose.foundation.text.selection.SelectionContainer and all androidx.compose.foundation.text.BasicTextFields.
@JvmField var isInheritedTextStyleEnabled = true
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.
@JvmField var isPausableCompositionInPrefetchEnabled = true
Selecting flag to enable the use of new PausableComposition in lazy layout prefetch. This change allows us to distribute work we need to do during the prefetch better, for example we can only perform the composition for parts of the LazyColumn's next item during one ui frame, and then continue composing the rest of it in the next frames.
@JvmField var isCacheWindowForPagerEnabled = true
With this flag on, Pager will use Cache Window 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.
@JvmField
var isBringIntoViewRltBouncyBehaviorInPagerFixEnabled: Boolean
When Pager was used with a keyboard in RTL the pages would bounce indefinitely due to the bring into view animation. If this flag is off the fix for that behavior will be disabled.
@JvmField var isCacheWindowRefillFixEnabled = true
If this flag is enabled, for lazy layout implementations that use androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow, if the dataset changes, the window mechanism will understand that it needs to re-fill the window from scratch. This is because there is no good way for the window to know that a possible non-visible item has changed. For instance, if C and D are 2 items in the cache window and later they're removed from the dataset, the cache window won't know it until it tries to prefetch them.
@JvmField
var isAnchoredDraggableTargetValueCalculationFixEnabled = true
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.
@JvmField
var isDelayPressesUsingGestureConsumptionEnabled = true
If this flag is enabled, Clickable will detect if it should delay press by using the new GestureNode structure where nodes can indicate if they're interested in a given PointerInputEvent. Moreover, all containers where a drag gesture happens (e.g. scrollable, draggable, anchored draggable) will cause the presses to be delayed.
@JvmField
var isTrackpadGestureHandlingEnabled: Boolean
Enables support of trackpad gesture events in foundation components.
This uses the additional trackpad gesture information enabled by ComposeUiFlags.isTrackpadGestureHandlingEnabled
@JvmField
var isNestedDraggablesTouchConflictFixEnabled = true
With this flag on, nested draggable components (e.g. Lists, Pagers, Grids) will handle conflicting gestures by deciding which has a higher priority.
@JvmField
var isNonSuspendingPointerInputInCombinedClickableEnabled = true
With this flag on we don't use suspend pointer input as part of Modifier.combinedClickable implementation as an optimization.
@JvmField
var isBasicTextFieldMinSizeOptimizationEnabled = true
This flag controls performance optimizations related to androidx.compose.foundation.text.BasicTextField's internal min height calculations.
@JvmField var isSkipItemPlacementAnimationFixEnabled = true
This flag controls the fix where item placement animation in androidx.compose.foundation.lazy.LazyColumn and androidx.compose.foundation.lazy.LazyRow is disabled when animated scroll happens.
@JvmField
var isReverseLayoutNestedScrollConnectionInPagerFixEnabled = true
This flag controls the fix where we correctly dispatch deltas in pager's default pageNestedScrollConnection by considering the role of reverse layout.
@JvmField
var isConcurrentTextFieldSelectionFixEnabled = true
This flag controls the fix where text selection is constrained to the text length to prevent crashes during concurrent text updates.