# ActivityEmbeddingRule

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

*** ** * ** ***


```
class ActivityEmbeddingRule : TestRule
```

<br />

*** ** * ** ***

A `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestRule.html` that will stub out the behavior of `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityEmbeddingController` and `https://developer.android.com/reference/kotlin/androidx/window/embedding/RuleController` with a more simple one that will support testing independent of the current platform.

By default `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule` has values as if the developer has not opted in to the ActivityEmbedding feature. There are no set rules, and each `https://developer.android.com/reference/android/app/Activity.html` is not embedded.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule#ActivityEmbeddingRule()()` |

| ### Public functions |
|---|---|
| `open https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule#apply(org.junit.runners.model.Statement,org.junit.runner.Description)(base: https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html, description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideIsActivityEmbedded(android.app.Activity,kotlin.Boolean)( activity: https://developer.android.com/reference/android/app/Activity.html, isActivityEmbedded: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Overrides the return value of `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityEmbeddingController#isActivityEmbedded(android.app.Activity)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideSplitInfo(android.app.Activity,kotlin.collections.List)(activity: https://developer.android.com/reference/android/app/Activity.html, splitInfoList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo>)` Overrides current split info reported by `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideSplitSupportStatus(androidx.window.embedding.SplitController.SplitSupportStatus)(status: https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus)` Overrides the return value of `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitSupportStatus()`. |

## Public constructors

### ActivityEmbeddingRule

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

```
ActivityEmbeddingRule()
```

## Public functions

### apply

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

```
open fun apply(base: Statement, description: Description): Statement
```

### overrideIsActivityEmbedded

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

```
fun overrideIsActivityEmbedded(
    activity: Activity,
    isActivityEmbedded: Boolean
): Unit
```

Overrides the return value of `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityEmbeddingController#isActivityEmbedded(android.app.Activity)`.

| Parameters |
|---|---|
| `activity: https://developer.android.com/reference/android/app/Activity.html` | `https://developer.android.com/reference/android/app/Activity.html` that will be passed to `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityEmbeddingController#isActivityEmbedded(android.app.Activity)`. |
| `isActivityEmbedded: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityEmbeddingController#isActivityEmbedded(android.app.Activity)` should return `true` for the `activity`. |

### overrideSplitInfo

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

```
fun overrideSplitInfo(activity: Activity, splitInfoList: List<SplitInfo>): Unit
```

Overrides current split info reported by `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity)`. The initial override value is set to an empty `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html`.

| Parameters |
|---|---|
| `activity: https://developer.android.com/reference/android/app/Activity.html` | the `https://developer.android.com/reference/android/app/Activity.html` corresponding to the `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideSplitInfo(android.app.Activity,kotlin.collections.List)`. |
| `splitInfoList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo>` | a list of `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo` that will be emitted through `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity)`. |

### overrideSplitSupportStatus

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

```
fun overrideSplitSupportStatus(status: SplitController.SplitSupportStatus): Unit
```

Overrides the return value of `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#splitSupportStatus()`.

| Parameters |
|---|---|
| `status: https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus` | the global `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController.SplitSupportStatus` that will be returned instead. |