WindowInfoController


public abstract class WindowInfoController


An interface to interact with Window properties and layout.

Summary

Public methods

static final @NonNull WindowInfoController

Gets an instance of WindowInfoController for the given Context.

abstract void

Dispatches a request to modify the visual state of the window.

Public methods

getInstance

Added in 1.6.0-alpha03
public static final @NonNull WindowInfoController getInstance(@UiContext @NonNull Context context)

Gets an instance of WindowInfoController for the given Context.

requestVisualState

Added in 1.6.0-alpha03
@MainThread
public abstract void requestVisualState(
    @UiContext @NonNull Context context,
    @NonNull VisualStateRequest request
)

Dispatches a request to modify the visual state of the window.

The requested state is evaluated against the task hierarchy by the system. It is automatically cleared when the requesting task is no longer active.

Note that this is a request; it is up to the system to determine whether the requested visual state will be respected based on device policies and hardware capabilities. Applications should observe WindowLayoutInfo.engagementModes to observe the actual applied state.

Note: Throws IllegalStateException if not called on the main thread, or if the provided context is not a UI context (e.g. an Application context).

On Android 16 (API level 37) and above, this request is forwarded to the system. On lower API levels, calling this method is a no-op.

Parameters
@UiContext @NonNull Context context

The Context used to dispatch the request.

@NonNull VisualStateRequest request

The VisualStateRequest containing the desired visual state.