# ComposeUiFlags

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/ComposeUiFlags.kt+class:androidx.compose.ui.ComposeUiFlags) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0) Common/AllAndroid/JVM
- 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.

```kotlin
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.

```kotlin
-assumevalues class androidx.compose.ui.ComposeUiFlags {
    public static int isRectTrackingEnabled return false
}
```

## Summary

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isAccessibilityShouldIncludeOffscreenChildrenEnabled()` 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 |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isBypassUnfocusableComposeViewEnabled()` This flag enables an alternate approach to fixing the issues addressed by the `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isViewFocusFixEnabled()` flag. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isFocusRestorationEnabled()` Enable focus restoration, by always saving focus. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isHardwareNavigationHandlingEnabled()` Guard for Hardware Navigation system default behavior in Compose. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isInitialFocusOnFocusableAvailable()` Enable initial focus when a focusable is added to a screen with no focusable content. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isMediaQueryIntegrationEnabled()` Enable the integration of `https://developer.android.com/reference/kotlin/androidx/compose/ui/package-summary#LocalUiMediaScope()` at the root compose view which provides various signals for adapting the UI across different devices. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isMinimalistLocalsEnabled()` Reduce provided CompositionLocals by letting them pull from LocalOwner / LocalAndroidComposeView dynamically when unprovided, instead of eagerly providing all of them. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isSkipNonImportantSemanticsNodesHitTestEnabled()` Enables hit test to continue searching for "semantic nodes" if the initial node that is hit is unimportant from an accessibility semantics node point of view. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isTrackpadPanHoverFixEnabled()` Fixes trackpad pan gestures (CLASSIFICATION_TWO_FINGER_SWIPE). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isTrackpadPinchReinterpretationEnabled()` Enables re-interpreting trackpad pinch gestures (CLASSIFICATION_PINCH) as mouse events with scale factor, rather than passing through fake finger touch events. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isTriggerMoveEventsWhenLocationHasNotChangedEnabled()` 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 |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isVectorDrawCacheSharingEnabled()` If enabled, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/VectorPainter` will use a shared cache to reuse `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/DrawCache` instances across different painters using the same `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isVelocityTrackerMinSampleSizeFixEnabled()` Enables calculating velocity from two sample points instead of returning zero. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isViewFocusFixEnabled()` This enables fixes for View focus. | Cmn |

## Public properties

### isAccessibilityShouldIncludeOffscreenChildrenEnabled

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0)

```
var isAccessibilityShouldIncludeOffscreenChildrenEnabled: 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.

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

### isBypassUnfocusableComposeViewEnabled

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
var isBypassUnfocusableComposeViewEnabled: Boolean
```

This flag enables an alternate approach to fixing the issues addressed by the `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isViewFocusFixEnabled()` flag.

### isFocusRestorationEnabled

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0)

```
var isFocusRestorationEnabled: Boolean
```

Enable focus restoration, by always saving focus. This flag depends on `https://developer.android.com/reference/kotlin/androidx/compose/ui/ComposeUiFlags#isInitialFocusOnFocusableAvailable()` also being true.

### isHardwareNavigationHandlingEnabled

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
var isHardwareNavigationHandlingEnabled: Boolean
```

Guard for Hardware Navigation system default behavior in Compose.

### isInitialFocusOnFocusableAvailable

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
var isInitialFocusOnFocusableAvailable: Boolean
```

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

### isMediaQueryIntegrationEnabled

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0)

```
var isMediaQueryIntegrationEnabled: Boolean
```

Enable the integration of `https://developer.android.com/reference/kotlin/androidx/compose/ui/package-summary#LocalUiMediaScope()` at the root compose view which provides various signals for adapting the UI across different devices.

This feature is experimental and is disabled by default.

### isMinimalistLocalsEnabled

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
var isMinimalistLocalsEnabled: Boolean
```

Reduce provided CompositionLocals by letting them pull from LocalOwner / LocalAndroidComposeView dynamically when unprovided, instead of eagerly providing all of them.

### isSkipNonImportantSemanticsNodesHitTestEnabled

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0)

```
var isSkipNonImportantSemanticsNodesHitTestEnabled: Boolean
```

Enables hit test to continue searching for "semantic nodes" if the initial node that is hit is unimportant from an accessibility semantics node point of view.

### isTrackpadPanHoverFixEnabled

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
var isTrackpadPanHoverFixEnabled: Boolean
```

Fixes trackpad pan gestures (CLASSIFICATION_TWO_FINGER_SWIPE).

### isTrackpadPinchReinterpretationEnabled

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.12.0)

```
var isTrackpadPinchReinterpretationEnabled: Boolean
```

Enables re-interpreting trackpad pinch gestures (CLASSIFICATION_PINCH) as mouse events with scale factor, rather than passing through fake finger touch events.

### isTriggerMoveEventsWhenLocationHasNotChangedEnabled

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.12.0)

```
var isTriggerMoveEventsWhenLocationHasNotChangedEnabled: 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.

### isVectorDrawCacheSharingEnabled

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
var isVectorDrawCacheSharingEnabled: Boolean
```

If enabled, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/VectorPainter` will use a shared cache to reuse `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/DrawCache` instances across different painters using the same `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector`.

This reduces redundant texture uploads and improves performance when the same vector is used multiple times within a composition tree, such as in a LazyColumn.

### isVelocityTrackerMinSampleSizeFixEnabled

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
var isVelocityTrackerMinSampleSizeFixEnabled: Boolean
```

Enables calculating velocity from two sample points instead of returning zero. This changes how velocity is calculated for flings, which may affect scrolling, nested scrolling, and similar gesture behaviors. Please file a bug report if disabling this flag resolves the issue.

### isViewFocusFixEnabled

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
var isViewFocusFixEnabled: Boolean
```

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