EmbeddingConfiguration.Builder


class EmbeddingConfiguration.Builder


Builder for creating an instance of EmbeddingConfiguration.

Summary

Public constructors

Public functions

EmbeddingConfiguration

Builds aEmbeddingConfiguration instance.

EmbeddingConfiguration.Builder

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

EmbeddingConfiguration.Builder

Sets the dim area behavior.

Public constructors

Builder

Added in 1.4.0
Builder()

Public functions

build

Added in 1.4.0
fun build(): EmbeddingConfiguration

Builds aEmbeddingConfiguration instance.

setAutoSaveEmbeddingState

Added in 1.5.0-alpha02
@RequiresWindowSdkExtension(version = 8)
fun setAutoSaveEmbeddingState(saveState: Boolean): EmbeddingConfiguration.Builder

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
saveState: Boolean

whether to save the embedding state

setDimAreaBehavior

Added in 1.4.0
@RequiresWindowSdkExtension(version = 5)
fun setDimAreaBehavior(area: EmbeddingConfiguration.DimAreaBehavior): EmbeddingConfiguration.Builder

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
area: EmbeddingConfiguration.DimAreaBehavior

The dim area.