# SplitController

# SplitController

Artifact:[androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window)  
[View Source](https://cs.android.com/search?q=file:androidx/window/embedding/SplitController.kt+class:androidx.window.embedding.SplitController)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/window/embedding/SplitController "View this page in Java")

<br />

```
class SplitController
```

<br />

*** ** * ** ***

The controller class that gets information about the currently active activity splits and provides interaction points to customize the splits and form new splits.

A split is a pair of containers that host activities in the same or different processes, combined under the same parent window of the hosting task.

A pair of activities can be put into a split by providing a static or runtime split rule and then launching the activities in the same task using[Activity.startActivity()](https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)).

## Summary

|                                                                                                                  ### Nested types                                                                                                                  |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[SplitController.SplitSupportStatus](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus) A class to determine if activity splits with Activity Embedding are currently available. |

|                                       ### Public companion functions                                        |
|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SplitController](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController) | [getInstance](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#getInstance(android.content.Context))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`)` Obtains an instance of[SplitController](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController). |

|                                                                                                                                                   ### Public functions                                                                                                                                                   |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                            | `@`[RequiresWindowSdkExtension](https://developer.android.com/reference/kotlin/androidx/window/RequiresWindowSdkExtension)`(version = 2)` [clearSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#clearSplitAttributesCalculator())`()` Clears the callback previously set by[setSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1)).                                                                                                                                                                                                                                                   |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                      | `@`[RequiresWindowSdkExtension](https://developer.android.com/reference/kotlin/androidx/window/RequiresWindowSdkExtension)`(version = 5)` [pinTopActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#pinTopActivityStack(kotlin.Int,androidx.window.embedding.SplitPinRule))`(taskId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, splitPinRule: `[SplitPinRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPinRule)`)` Pins the top-most[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)to keep the stack of the Activities to be always positioned on top.                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                            | `@`[RequiresWindowSdkExtension](https://developer.android.com/reference/kotlin/androidx/window/RequiresWindowSdkExtension)`(version = 2)` [setSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1))`(` ` calculator: (`[SplitAttributesCalculatorParams](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams)`) `->` `[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes) `)` Sets or replaces the previously registered[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)calculator. |
| [Flow](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html)`<`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)`>>` | [splitInfoList](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity))`(activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)`)` A[Flow](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html)of[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)list that contains the current split states that this[activity](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity))is part of.                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                            | `@`[RequiresWindowSdkExtension](https://developer.android.com/reference/kotlin/androidx/window/RequiresWindowSdkExtension)`(version = 5)` [unpinTopActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#unpinTopActivityStack(kotlin.Int))`(taskId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Unpins the pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack).                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                            | `@`[RequiresWindowSdkExtension](https://developer.android.com/reference/kotlin/androidx/window/RequiresWindowSdkExtension)`(version = 3)` [updateSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#updateSplitAttributes(androidx.window.embedding.SplitInfo,androidx.window.embedding.SplitAttributes))`(` ` splitInfo: `[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)`,` ` splitAttributes: `[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes) `)` Updates the[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)of a split pair.           |

|                                                               ### Public properties                                                               |
|---------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SplitController.SplitSupportStatus](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus) | [splitSupportStatus](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitSupportStatus()) Indicates whether split functionality is supported on the device. |

## Public companion functions

### getInstance

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)  

```
fun getInstance(context: Context): SplitController
```

Obtains an instance of[SplitController](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController).  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html) | the[Context](https://developer.android.com/reference/android/content/Context.html)to initialize the controller with |

## Public functions

### clearSplitAttributesCalculator

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)  

```
@RequiresWindowSdkExtension(version = 2)
fun clearSplitAttributesCalculator(): Unit
```

Clears the callback previously set by[setSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1)). The caller**must** make sure if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is greater than or equal to 2.  

|                                                                  Throws                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.UnsupportedOperationException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html) | if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is less than 2. |

### pinTopActivityStack

Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/window#1.4.0)  

```
@RequiresWindowSdkExtension(version = 5)
fun pinTopActivityStack(taskId: Int, splitPinRule: SplitPinRule): Boolean
```

Pins the top-most[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)to keep the stack of the Activities to be always positioned on top. The rest of the activities in the Task will be split with the pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack). The pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)would also have isolated activity navigation in which only the activities that are started from the pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)can be added on top of the[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack).

The pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)is unpinned whenever the pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)is expanded. Use[SplitPinRule.Builder.setSticky](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPinRule.Builder#setSticky(kotlin.Boolean))if the same[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)should be pinned again whenever the[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)is on top and split with another[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)again.

The caller**must** make sure if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is greater than or equal to 5.  

|                                                      Parameters                                                       |
|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `taskId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                 | The id of the Task that top[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)should be pinned.                         |
| `splitPinRule: `[SplitPinRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPinRule) | The SplitRule that specifies how the top[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)should be split with others. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Returns`true`if the top[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)is successfully pinned. Otherwise,`false`. Few examples are: 1. There's no[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack). 2. There is already an existing pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack). 3. There's no other[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)to split with the top[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack). |

|                                                                  Throws                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.UnsupportedOperationException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html) | if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is less than 5. |

### setSplitAttributesCalculator

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)  

```
@RequiresWindowSdkExtension(version = 2)
fun setSplitAttributesCalculator(
    calculator: (SplitAttributesCalculatorParams) -> SplitAttributes
): Unit
```

Sets or replaces the previously registered[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)calculator.

**Note** that it's callers' responsibility to check if this API is supported by checking[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())before using the this API. It is suggested to always set meaningful[SplitRule.defaultSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#defaultSplitAttributes())in case this API is not supported on some devices.

Also, replacing the calculator will only update existing split pairs after a change in the window or device state, such as orientation changes or folding state changes.

The[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)calculator is a function to compute the current[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)for the given[SplitRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule)with the current device and window state. Then The calculator will be invoked if either:

- An activity is started and matches a registered[SplitRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule).

- A parent configuration is updated and there's an existing split pair.

By default,[SplitRule.defaultSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#defaultSplitAttributes())are applied if the parent container's[WindowMetrics](https://developer.android.com/reference/kotlin/androidx/window/layout/WindowMetrics)satisfies the[SplitRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule)'s dimensions requirements, which are[SplitRule.minWidthDp](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#minWidthDp()),[SplitRule.minHeightDp](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#minHeightDp())and[SplitRule.minSmallestWidthDp](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#minSmallestWidthDp()). The[SplitRule.defaultSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#defaultSplitAttributes())can be set by

- [SplitRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule)Builder APIs, which are[SplitPairRule.Builder.setDefaultSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPairRule.Builder#setDefaultSplitAttributes(androidx.window.embedding.SplitAttributes))and[SplitPlaceholderRule.Builder.setDefaultSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPlaceholderRule.Builder#setDefaultSplitAttributes(androidx.window.embedding.SplitAttributes)).

- Specifying with`splitRatio`and`splitLayoutDirection`attributes in`<SplitPairRule>`or`<SplitPlaceHolderRule>`tags in XML files.

Developers may want to apply different[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)for different device or window states. For example, on foldable devices, developers may want to split the screen vertically if the device is in landscape, fill the screen if the device is in portrait and split the screen horizontally if the device is in[tabletop posture](https://developer.android.com/guide/topics/ui/foldables#postures). In this case, the[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)can be customized by the[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)calculator, which takes effects after calling this API. Developers can also clear the calculator by[clearSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#clearSplitAttributesCalculator()). Then, developers could implement the[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)calculator as the sample linked below shows.  

```kotlin
import androidx.window.embedding.EmbeddingAnimationBackground
import androidx.window.embedding.EmbeddingAnimationParams
import androidx.window.embedding.SplitAttributes
import androidx.window.embedding.SplitAttributes.SplitType.Companion.SPLIT_TYPE_EQUAL
import androidx.window.embedding.SplitAttributes.SplitType.Companion.SPLIT_TYPE_EXPAND
import androidx.window.embedding.SplitAttributes.SplitType.Companion.SPLIT_TYPE_HINGE
import androidx.window.embedding.SplitController
import androidx.window.layout.FoldingFeature

SplitController.getInstance(context).setSplitAttributesCalculator { params ->
    val tag = params.splitRuleTag
    val parentWindowMetrics = params.parentWindowMetrics
    val parentConfig = params.parentConfiguration
    val foldingFeatures =
        params.parentWindowLayoutInfo.displayFeatures.filterIsInstance<FoldingFeature>()
    val foldingState = if (foldingFeatures.size == 1) foldingFeatures[0] else null
    // Tag can be used to filter the SplitRule to apply the SplitAttributes
    if (TAG_SPLIT_RULE_MAIN != tag && params.areDefaultConstraintsSatisfied) {
        return@setSplitAttributesCalculator params.defaultSplitAttributes
    }

    // This sample will make the app show a layout to
    // - split the task bounds vertically if the device is in landscape
    // - fill the task bounds if the device is in portrait and its folding state does not
    //   split the screen
    // - split the task bounds horizontally in tabletop mode
    val bounds = parentWindowMetrics.bounds
    if (foldingState?.isSeparating == true) {
        // Split the parent container that followed by the hinge if the hinge separates the
        // parent window.
        return@setSplitAttributesCalculator SplitAttributes.Builder()
            .setSplitType(SPLIT_TYPE_HINGE)
            .setLayoutDirection(
                if (foldingState.orientation == FoldingFeature.Orientation.HORIZONTAL) {
                    SplitAttributes.LayoutDirection.TOP_TO_BOTTOM
                } else {
                    SplitAttributes.LayoutDirection.LOCALE
                }
            )
            // Optionally set the animation background and change transition animation to use
            // when switching between vertical and horizontal
            .setAnimationParams(
                EmbeddingAnimationParams.Builder()
                    .setAnimationBackground(
                        EmbeddingAnimationBackground.createColorBackground(Color.GRAY)
                    )
                    .setChangeAnimation(EmbeddingAnimationParams.AnimationSpec.JUMP_CUT)
                    .build()
            )
            .build()
    }
    return@setSplitAttributesCalculator if (
        parentConfig.screenWidthDp >= 600 && bounds.width() >= bounds.height()
    ) {
        // Split the parent container equally and vertically if the device is in landscape.
        SplitAttributes.Builder()
            .setSplitType(SPLIT_TYPE_EQUAL)
            .setLayoutDirection(SplitAttributes.LayoutDirection.LOCALE)
            // Optionally set the animation background and change transition animation to use
            // when switching between vertical and horizontal
            .setAnimationParams(
                EmbeddingAnimationParams.Builder()
                    .setAnimationBackground(
                        EmbeddingAnimationBackground.createColorBackground(Color.GRAY)
                    )
                    .setChangeAnimation(EmbeddingAnimationParams.AnimationSpec.JUMP_CUT)
                    .build()
            )
            .build()
    } else {
        // Expand containers if the device is in portrait or the width is less than 600 dp.
        SplitAttributes.Builder().setSplitType(SPLIT_TYPE_EXPAND).build()
    }
}
```  

|                                                                                                                                   Parameters                                                                                                                                   |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `calculator: (`[SplitAttributesCalculatorParams](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams)`) `->` `[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes) | the function to calculate[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)based on the[SplitAttributesCalculatorParams](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams). It will replace the previously set if it exists. |

|                                                                  Throws                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.UnsupportedOperationException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html) | if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is less than 2. |

### splitInfoList

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)  

```
fun splitInfoList(activity: Activity): Flow<List<SplitInfo>>
```

A[Flow](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html)of[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)list that contains the current split states that this[activity](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity))is part of.

An activity can be in zero, one or more[active splits](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo). More than one active split is possible if an activity created multiple containers to side, stacked on top of each other. Or it can be in two different splits at the same time - in a secondary container for one (it was launched to the side) and in the primary for another (it launched another activity to the side). The reported splits in the list are ordered from bottom to top by their z-order, more recent splits appearing later. Guaranteed to be called at least once to report the most recent state.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html) | The[Activity](https://developer.android.com/reference/android/app/Activity.html)that is interested in getting the split states |

|                                                                                                                                                         Returns                                                                                                                                                          |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Flow](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html)`<`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)`>>` | a[Flow](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html)of[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)list that includes this[activity](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity)) |

### unpinTopActivityStack

Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/window#1.4.0)  

```
@RequiresWindowSdkExtension(version = 5)
fun unpinTopActivityStack(taskId: Int): Unit
```

Unpins the pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack). The[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)will still be the top-most[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)right after unpinned, and the[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)could be expanded or continue to be split with the next top[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)if the current state matches any of the existing[SplitPairRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPairRule). It is a no-op call if the task does not have a pinned[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack).

The caller**must** make sure if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is greater than or equal to 5.  

|                                      Parameters                                       |
|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `taskId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The id of the Task that top[ActivityStack](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack)should be unpinned. |

|                                                                  Throws                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.UnsupportedOperationException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html) | if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is less than 5. |

### updateSplitAttributes

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)  

```
@RequiresWindowSdkExtension(version = 3)
fun updateSplitAttributes(
    splitInfo: SplitInfo,
    splitAttributes: SplitAttributes
): Unit
```

Updates the[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)of a split pair. This is an alternative to using a split attributes calculator callback set in[setSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1)), useful when apps only need to update the splits in a few cases proactively but rely on the default split attributes most of the time otherwise.

The provided split attributes will be used instead of the associated[SplitRule.defaultSplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#defaultSplitAttributes()).

**Note** that the split attributes may be updated if split attributes calculator callback is registered and invoked. If[setSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1))is used, the callback will still be applied to each[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)when there's either:

- A new Activity being launched.

- A window or device state updates (e,g. due to screen rotation or folding state update).

In most cases it is suggested to use ActivityEmbeddingController.invalidateTopVisibleActivityStacks if a calculator has been set through[setSplitAttributesCalculator](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1)).  

|                                                           Parameters                                                           |
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| `splitInfo: `[SplitInfo](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo)                   | the split pair to update                                                                                                    |
| `splitAttributes: `[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes) | the[SplitAttributes](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes)to be applied |

|                                                                  Throws                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.UnsupportedOperationException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html) | if[WindowSdkExtensions.extensionVersion](https://developer.android.com/reference/kotlin/androidx/window/WindowSdkExtensions#extensionVersion())is less than 3. |

## Public properties

### splitSupportStatus

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)  

```
val splitSupportStatus: SplitController.SplitSupportStatus
```

Indicates whether split functionality is supported on the device. Note that devices might not enable splits in all states or conditions. For example, a foldable device with multiple screens can choose to collapse splits when apps run on the device's small display, but enable splits when apps run on the device's large display. In cases like this,[splitSupportStatus](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitSupportStatus())always returns[SplitSupportStatus.SPLIT_AVAILABLE](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus#SPLIT_AVAILABLE()), and if the split is collapsed, activities are launched on top, following the non-activity embedding model.

Also the[WindowProperties.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED](https://developer.android.com/reference/kotlin/androidx/window/WindowProperties#PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED())must be enabled in AndroidManifest withinin order to get the correct state or[SplitSupportStatus.SPLIT_ERROR_PROPERTY_NOT_DECLARED](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus#SPLIT_ERROR_PROPERTY_NOT_DECLARED())will be returned in some cases.  

|                                                                     See also                                                                      |
|---------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [SplitController.SplitSupportStatus](https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus) |   |