Stay organized with collections Save and categorize content based on your preferences.

TestActivityStack

public final class TestActivityStack


Summary

Public methods

static final @NonNull ActivityStack
@ExperimentalWindowApi
createTestActivityStack(
    @NonNull List<@NonNull Activity> activitiesInProcess,
    boolean isEmpty
)

Creates an ActivityStack instance for testing, which defaults to an ActivityStack with cross-process activities.

Public methods

createTestActivityStack

@ExperimentalWindowApi
public static final @NonNull ActivityStack createTestActivityStack(
    @NonNull List<@NonNull Activity> activitiesInProcess,
    boolean isEmpty
)

Creates an ActivityStack instance for testing, which defaults to an ActivityStack with cross-process activities.

The activitiesInProcess can be passed from the activity obtained from androidx.test.core.app.ActivityScenario or even mock Activities.

Parameters
@NonNull List<@NonNull Activity> activitiesInProcess

The Activity list with the same process of the host task with empty list as the default value

boolean isEmpty

Indicates whether this ActivityStack contains any Activity regardless of the process with false as the default value

Returns
@NonNull ActivityStack

An ActivityStack instance for testing