EmbeddingConfiguration.Builder


public final class EmbeddingConfiguration.Builder


Builder for creating an instance of EmbeddingConfiguration.

Summary

Public constructors

Public methods

final @NonNull EmbeddingConfiguration

Builds aEmbeddingConfiguration instance.

final @NonNull EmbeddingConfiguration.Builder
@RequiresWindowSdkExtension(version = 8)
setAutoSaveEmbeddingState(boolean saveState)

Sets whether to auto save the embedding state to the system, which can be used to restore the app embedding state once the app process is restarted (if applicable).

final @NonNull EmbeddingConfiguration.Builder

Sets the dim area behavior.

Public constructors

Builder

Added in 1.4.0
public Builder()

Public methods

build

Added in 1.4.0
public final @NonNull EmbeddingConfiguration build()

Builds aEmbeddingConfiguration instance.

setAutoSaveEmbeddingState

Added in 1.5.0-alpha02
@RequiresWindowSdkExtension(version = 8)
public final @NonNull EmbeddingConfiguration.Builder setAutoSaveEmbeddingState(boolean saveState)

Sets whether to auto save the embedding state to the system, which can be used to restore the app embedding state once the app process is restarted (if applicable).

The embedding state is not saved by default, in which case the embedding state and the embedded activities are removed once the app process is killed.

Note that the applications should set the EmbeddingRules using RuleController.setRules when the application is initializing, such as configured in androidx.startup.Initializer or in android.app.Application.onCreate, in order to allow the library to restore the state properly. Otherwise, the state may not be restored and the activities may not be started and layout as expected.

This can be supported only if the Window Extensions version of the target device is equals or higher than required API level. Otherwise, it would be no-op on a target device that has lower API level.

Parameters
boolean saveState

whether to save the embedding state

setDimAreaBehavior

Added in 1.4.0
@RequiresWindowSdkExtension(version = 5)
public final @NonNull EmbeddingConfiguration.Builder setDimAreaBehavior(@NonNull EmbeddingConfiguration.DimAreaBehavior area)

Sets the dim area behavior. By default, the DimAreaBehavior.UNDEFINED is used if not set.

This can be supported only if the Window Extensions version of the target device is equals or higher than required API level. Otherwise, it would be no-op on a target device that has lower API level.

Parameters
@NonNull EmbeddingConfiguration.DimAreaBehavior area

The dim area.