ComposeUiFlags
-
Cmn
@ExperimentalComposeUiApi
object 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 |
Enable WindowInsets rulers: |
Cmn
|
Boolean |
With this flag on, the adaptive refresh rate (ARR) feature will be enabled. |
Cmn
|
Boolean |
This flag enables an alternate approach to fixing the issues addressed by the |
Cmn
|
Boolean |
Enable fix for |
Cmn
|
Boolean |
This property is deprecated. This flag is no longer needed. |
Cmn
|
Boolean |
This property is deprecated. This flag is no longer needed. |
Cmn
|
Boolean |
This flag enables setting the shape semantics property in the graphicsLayer modifiers. |
Cmn
|
Boolean |
This flag enables a fix for b/388590015. |
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 for enabling nested scroll interop fix for propagating integers, this fixes an issue with interop between compose and views nested scroll where small deltas with the wrong sign were being scaled up due to the rounding used. |
Cmn
|
Boolean |
This property is deprecated. This flag is no longer needed. |
Cmn
|
Boolean |
Flag enables optimized focus change dispatching logic. |
Cmn
|
Boolean |
Enables automatic pinning of interop AndroidViews when they are focused inside lazy containers. |
Cmn
|
Boolean |
This flag enables a fix for b/378570682. |
Cmn
|
Boolean |
Enable performance optimization where coordinates calculations like |
Cmn
|
Boolean |
This property is deprecated. This flag is no longer needed. |
Cmn
|
Boolean |
With this flag on, requesting focus on a non-focusable focus target will request focus for one of its children, which makes |
Cmn
|
Boolean |
Enable fix to scroll target rect to the center when performing scroll capture, thus generally avoiding floating content at the top and bottom of the UI. |
Cmn
|
Boolean |
With this flag on, the new semantic version of Autofill APIs will be enabled. |
Cmn
|
Boolean |
This enables fixes for View focus. |
Cmn
|
Public properties
areWindowInsetsRulersEnabled
var areWindowInsetsRulersEnabled: Boolean
Enable WindowInsets rulers:
-
SystemBarsRulers -
ImeRulers -
StatusBarsRulers -
NavigationBarsRulers -
CaptionBarRulers -
MandatorySystemGesturesRulers -
TappableElementRulers -
WaterfallRulers -
SafeDrawingRulers -
SafeGesturesRulers -
SafeContentRulers
isAdaptiveRefreshRateEnabled
var isAdaptiveRefreshRateEnabled: Boolean
With this flag on, the adaptive refresh rate (ARR) feature will be enabled. A preferred frame rate can be set on a Composable through frame rate modifier: Modifier.preferredFrameRate
isBypassUnfocusableComposeViewEnabled
var isBypassUnfocusableComposeViewEnabled: Boolean
This flag enables an alternate approach to fixing the issues addressed by the isViewFocusFixEnabled flag.
isCanScrollUsingLastDownEventFixEnabled
var isCanScrollUsingLastDownEventFixEnabled: Boolean
Enable fix for [ComposeView.canScrollHorizontally] and [ComposeView.canScrollVertically] methods. Previously, these methods would sometimes use the last MOVE event's position to determine if scrolling was possible, even if the gesture started with a DOWN event at a different location. This could lead to incorrect scrollability checks, especially when a scrollable container was touched and then moved. With this flag enabled, the methods correctly use the position of the initial DOWN event to establish the pointer position for an event that started on a scrollable container, ensuring accurate scroll checks.
isClearFocusOnResetEnabled
var isClearFocusOnResetEnabled: Boolean
Enable clearing focus when a focused item is removed from a lazyList.
isFocusActionExitsTouchModeEnabled
var isFocusActionExitsTouchModeEnabled: Boolean
With this flag on, when an AccessibilityService performs ACTION_FOCUS on a Composable node, if it is in touch mode, it will exit touch mode first, then try to request focus on the node.
isGraphicsLayerShapeSemanticsEnabled
var isGraphicsLayerShapeSemanticsEnabled: Boolean
This flag enables setting the shape semantics property in the graphicsLayer modifiers.
isIgnoreInvalidPrevFocusRectEnabled
var isIgnoreInvalidPrevFocusRectEnabled: Boolean
This flag enables a fix for b/388590015. The view system ignores an invalid prevFocusRect when requestFocus is called, so we support this behavior in Compose too.
isIndirectPointerNavigationGestureDetectorEnabled
var isIndirectPointerNavigationGestureDetectorEnabled: Boolean
Flag for enabling indirect pointer event navigation gestures in Compose.
isInitialFocusOnFocusableAvailable
var isInitialFocusOnFocusableAvailable: Boolean
Enable initial focus when a focusable is added to a screen with no focusable content.
isNestedScrollInteropIntegerPropagationEnabled
var isNestedScrollInteropIntegerPropagationEnabled: Boolean
Flag for enabling nested scroll interop fix for propagating integers, this fixes an issue with interop between compose and views nested scroll where small deltas with the wrong sign were being scaled up due to the rounding used.
isNoPinningInFocusRestorationEnabled
var isNoPinningInFocusRestorationEnabled: Boolean
With this flag on, Modifier.focusRestorer() will not pin the item that needs to be restored. Users are responsible for providing a key for the item that needs to be restored b/330696779.
isOptimizedFocusEventDispatchEnabled
var isOptimizedFocusEventDispatchEnabled: Boolean
Flag enables optimized focus change dispatching logic.
isPinningFocusedAndroidViewsEnabled
var isPinningFocusedAndroidViewsEnabled: Boolean
Enables automatic pinning of interop AndroidViews when they are focused inside lazy containers.
isPre26FocusFinderFixEnabled
var isPre26FocusFinderFixEnabled: Boolean
This flag enables a fix for b/378570682. For API >=26. We attempt to manually find the next focusable item for 1-D focus search cases when Compose does not have any focusable content.
isRectManagerOffsetUsageFromLayoutCoordinatesEnabled
var isRectManagerOffsetUsageFromLayoutCoordinatesEnabled: Boolean
Enable performance optimization where coordinates calculations like androidx.compose.ui.layout.LayoutCoordinates.localToRoot are using the cached offsets we already have in RectManager, instead of traversing the whole tree on each call.
isRemoveFocusedViewFixEnabled
var isRemoveFocusedViewFixEnabled: Boolean
When an embedded view that is focused is removed from the hierarchy, it triggers a requestFocus() which tries to re-assign focus before the previous composition is complete. This flag enables a fix for this issue.
isRequestFocusOnNonFocusableFocusTargetEnabled
var isRequestFocusOnNonFocusableFocusTargetEnabled: Boolean
With this flag on, requesting focus on a non-focusable focus target will request focus for one of its children, which makes FocusTargetModifierNode.requestFocus consistent with FocusRequester.requestFocus and FocusRequesterModifierNode.requestFocus
isScrollCaptureCenteringEnabled
var isScrollCaptureCenteringEnabled: Boolean
Enable fix to scroll target rect to the center when performing scroll capture, thus generally avoiding floating content at the top and bottom of the UI.
isSemanticAutofillEnabled
var isSemanticAutofillEnabled: Boolean
With this flag on, the new semantic version of Autofill APIs will be enabled. Turning this flag off will disable the new Semantic Autofill APIs, and the new refactored semantics.
isViewFocusFixEnabled
var isViewFocusFixEnabled: Boolean
This enables fixes for View focus. The changes are large enough to require a flag to allow disabling them.