# 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)

*** ** * ** ***


```
public final class ActivityEmbeddingRule implements 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/androidx/window/embedding/ActivityEmbeddingController` and `https://developer.android.com/reference/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/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/androidx/window/testing/embedding/ActivityEmbeddingRule#ActivityEmbeddingRule()()` |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html` | `https://developer.android.com/reference/androidx/window/testing/embedding/ActivityEmbeddingRule#apply(org.junit.runners.model.Statement,org.junit.runner.Description)(@https://developer.android.com/reference/androidx/annotation/NonNull https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html base, @https://developer.android.com/reference/androidx/annotation/NonNull https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` |
| `final void` | `https://developer.android.com/reference/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideIsActivityEmbedded(android.app.Activity,kotlin.Boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity, boolean isActivityEmbedded )` Overrides the return value of `https://developer.android.com/reference/androidx/window/embedding/ActivityEmbeddingController#isActivityEmbedded(android.app.Activity)`. |
| `final void` | `https://developer.android.com/reference/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideSplitInfo(android.app.Activity,kotlin.collections.List)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitInfo> splitInfoList )` Overrides current split info reported by `https://developer.android.com/reference/androidx/window/embedding/SplitController#splitInfoList(android.app.Activity)`. |
| `final void` | `https://developer.android.com/reference/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideSplitSupportStatus(androidx.window.embedding.SplitController.SplitSupportStatus)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitController.SplitSupportStatus status )` Overrides the return value of `https://developer.android.com/reference/androidx/window/embedding/SplitController#splitSupportStatus()`. |

## Public constructors

### ActivityEmbeddingRule

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

```
public ActivityEmbeddingRule()
```

## Public methods

### apply

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

```
public @NonNull Statement apply(@NonNull Statement base, @NonNull Description description)
```

### overrideIsActivityEmbedded

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

```
public final void overrideIsActivityEmbedded(
    @NonNull Activity activity,
    boolean isActivityEmbedded
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity` | `https://developer.android.com/reference/android/app/Activity.html` that will be passed to `https://developer.android.com/reference/androidx/window/embedding/ActivityEmbeddingController#isActivityEmbedded(android.app.Activity)`. |
| `boolean isActivityEmbedded` | whether `https://developer.android.com/reference/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)

```
public final void overrideSplitInfo(
    @NonNull Activity activity,
    @NonNull List<@NonNull SplitInfo> splitInfoList
)
```

Overrides current split info reported by `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity` | the `https://developer.android.com/reference/android/app/Activity.html` corresponding to the `https://developer.android.com/reference/androidx/window/testing/embedding/ActivityEmbeddingRule#overrideSplitInfo(android.app.Activity,kotlin.collections.List)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitInfo> splitInfoList` | a list of `https://developer.android.com/reference/androidx/window/embedding/SplitInfo` that will be emitted through `https://developer.android.com/reference/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)

```
public final void overrideSplitSupportStatus(
    @NonNull SplitController.SplitSupportStatus status
)
```

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

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