ComposeUiFlags


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() {
        ComposeUiFlags.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.ui.ComposeUiFlags {
    public static int isRectTrackingEnabled return false
}

Summary

Public properties

Boolean

Enables a change where off-screen children of the partially visible merging nodes (e.g. a Text node of a Button) inside scrollable container are now also reported in the semantics tree for Accessibility needs.

Cmn
Boolean

This flag enables an alternate approach to fixing the issues addressed by the isViewFocusFixEnabled flag.

Cmn
Boolean

Enable focus restoration, by always saving focus.

Cmn
Boolean

This flag enables setting the shape semantics property in the graphicsLayer modifiers.

Cmn
Boolean

Flag for enabling indirect pointer event navigation gestures in Compose.

Cmn
Boolean

Enable initial focus when a focusable is added to a screen with no focusable content.

Cmn
Boolean

Flag enables optimized focus change dispatching logic.

Cmn
Boolean

Enables support of trackpad gesture events.

Cmn
Boolean

Enables a fix where TraversableNode traversal method findNearestAncestor will take into consideration any delegates that might also be traversable.

Cmn
Boolean

This enables fixes for View focus.

Cmn

Public properties

isAccessibilityShouldIncludeOffscreenChildrenEnabled

var isAccessibilityShouldIncludeOffscreenChildrenEnabledBoolean

Enables a change where off-screen children of the partially visible merging nodes (e.g. a Text node of a Button) inside scrollable container are now also reported in the semantics tree for Accessibility needs.

Enabled is correct, and it should be enabled in all apps.

isBypassUnfocusableComposeViewEnabled

var isBypassUnfocusableComposeViewEnabledBoolean

This flag enables an alternate approach to fixing the issues addressed by the isViewFocusFixEnabled flag.

isFocusRestorationEnabled

var isFocusRestorationEnabledBoolean

Enable focus restoration, by always saving focus. This flag depends on isInitialFocusOnFocusableAvailable also being true.

isGraphicsLayerShapeSemanticsEnabled

var isGraphicsLayerShapeSemanticsEnabledBoolean

This flag enables setting the shape semantics property in the graphicsLayer modifiers.

isIndirectPointerNavigationGestureDetectorEnabled

var isIndirectPointerNavigationGestureDetectorEnabledBoolean

Flag for enabling indirect pointer event navigation gestures in Compose.

isInitialFocusOnFocusableAvailable

var isInitialFocusOnFocusableAvailableBoolean

Enable initial focus when a focusable is added to a screen with no focusable content.

isOptimizedFocusEventDispatchEnabled

var isOptimizedFocusEventDispatchEnabledBoolean

Flag enables optimized focus change dispatching logic.

isTrackpadGestureHandlingEnabled

var isTrackpadGestureHandlingEnabledBoolean

Enables support of trackpad gesture events.

If enabled, androidx.compose.ui.input.pointer.PointerEvents can have type of androidx.compose.ui.input.pointer.PointerEventType.Pan and androidx.compose.ui.input.pointer.PointerEventType.Scale, corresponding to gestures on a trackpad.

These trackpad gestures will also generally be treated as mouse, with the exact behavior depending on platform specifics.

isTraversableDelegatesFixEnabled

var isTraversableDelegatesFixEnabledBoolean

Enables a fix where TraversableNode traversal method findNearestAncestor will take into consideration any delegates that might also be traversable.

isViewFocusFixEnabled

var isViewFocusFixEnabledBoolean

This enables fixes for View focus. The changes are large enough to require a flag to allow disabling them.