# WindowInfoTracker

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/layout/WindowInfoTracker.kt+class:androidx.window.layout.WindowInfoTracker) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

*** ** * ** ***

<br />

```
public interface WindowInfoTracker
```

<br />

Known direct subclasses [WindowInfoTrackerCallbackAdapter](https://developer.android.com/reference/androidx/window/java/layout/WindowInfoTrackerCallbackAdapter)

|---|---|
| `https://developer.android.com/reference/androidx/window/java/layout/WindowInfoTrackerCallbackAdapter` | **This class is deprecated.** This adapter is no longer necessary. |

*** ** * ** ***

An interface to provide all the relevant info about a `https://developer.android.com/reference/android/view/Window.html`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getOrCreate(android.content.Context)` | to get an instance. |

## Summary

| ### Public methods |
|---|---|
| `default @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 9) https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Returns the current `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` for the given `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)`. |
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getOrCreate(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Provide an instance of `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker` that is associated to the given `https://developer.android.com/reference/android/content/Context.html`. |
| `default @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/layout/SupportedPosture>` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getSupportedPostures()()` Returns the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/window/layout/SupportedPosture` values. |
| `default void` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#registerWindowEngagementInfoListener(android.content.Context,java.util.concurrent.Executor,androidx.core.util.Consumer)( @https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/Consumer<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo> listener )` Registers a `https://developer.android.com/reference/androidx/annotation/UiContext` listener to consume `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` values. |
| `default void` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#registerWindowLayoutInfoListener(android.content.Context,java.util.concurrent.Executor,androidx.core.util.Consumer)( @https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/Consumer<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo> listener )` Registers a `https://developer.android.com/reference/androidx/annotation/UiContext` listener to consume `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` values. |
| `default void` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#unregisterWindowEngagementInfoListener(androidx.core.util.Consumer)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/Consumer<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo> listener )` Unregister a listener to stop consuming `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` values. |
| `default void` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#unregisterWindowLayoutInfoListener(androidx.core.util.Consumer)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/Consumer<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo> listener )` Unregister a listener to stop consuming `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` values. |
| `default @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowEngagementInfo(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` that contains the current engagement modes. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.app.Activity)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity)` A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` that contains all the available features. |
| `default @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` that contains all the available features. |

| ### Extension functions |
|---|---|
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoFlowable(android.app.Activity)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity )` Return a `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Flowable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoFlowable(android.app.Activity)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity )` Return a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoFlowable(android.content.Context)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context )` Return a `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Flowable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoFlowable(android.content.Context)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context )` Return a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoObservable(android.app.Activity)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity )` Return an `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Observable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoObservable(android.app.Activity)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity )` Return an `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoObservable(android.content.Context)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context )` Return an `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Observable.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo>` | `https://developer.android.com/reference/androidx/window/layout/WindowInfoTrackerRx.https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#(androidx.window.layout.WindowInfoTracker).windowLayoutInfoObservable(android.content.Context)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker receiver, @https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context )` Return an `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |

## Public methods

### getCurrentWindowLayoutInfo

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

```
@RequiresWindowSdkExtension(version = 9)
default @NonNull WindowLayoutInfo getCurrentWindowLayoutInfo(@UiContext @NonNull Context context)
```

Returns the current `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` for the given `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)`.

This API provides a convenient way to access the current `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. It can be used after the `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)` associated window has been created, such as `https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)`. Calling it before that will return an empty info.

For apps that need to update layout UI based on the `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`, it should also listen to `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` for any changes later.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | a `https://developer.android.com/reference/androidx/annotation/UiContext` such as an `https://developer.android.com/reference/android/app/Activity.html`, an `https://developer.android.com/reference/android/inputmethodservice/InputMethodService.html`, or an instance created via `https://developer.android.com/reference/android/content/Context.html#createWindowContext(android.view.Display, int, android.os.Bundle)` that listens to configuration changes. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` | the current `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` for the given `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)`. If the `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)` is not associated with a window, returns an empty `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | if `https://developer.android.com/reference/androidx/window/WindowSdkExtensions#extensionVersion()` is less than 9. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | when `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getCurrentWindowLayoutInfo(android.content.Context)` is not an `https://developer.android.com/reference/androidx/annotation/UiContext`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-not-implemented-error/index.html` | when this method has no supporting implementation. |

### getOrCreate

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

```
default static final @NonNull WindowInfoTracker getOrCreate(@NonNull Context context)
```

Provide an instance of `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker` that is associated to the given `https://developer.android.com/reference/android/content/Context.html`. The instance created should be safe to retain globally. The actual data is provided by `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` and requires an `https://developer.android.com/reference/android/app/Activity.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | Any valid `https://developer.android.com/reference/android/content/Context.html`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### getSupportedPostures

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

```
@RequiresWindowSdkExtension(version = 6)
default @NonNull List<@NonNull SupportedPosture> getSupportedPostures()
```

Returns the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/window/layout/SupportedPosture` values. This value will not change during runtime. These values are for determining if the device supports the given `https://developer.android.com/reference/androidx/window/layout/SupportedPosture` but does not mean the device is in the given `https://developer.android.com/reference/androidx/window/layout/SupportedPosture`. Use `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` to determine the current state of the `https://developer.android.com/reference/androidx/window/layout/DisplayFeature`'s on the device.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | if `https://developer.android.com/reference/androidx/window/WindowSdkExtensions#extensionVersion()` is less than 6. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-not-implemented-error/index.html` | if a derived test class does not override this method. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### registerWindowEngagementInfoListener

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

```
default void registerWindowEngagementInfoListener(
    @UiContext @NonNull Context context,
    @NonNull Executor executor,
    @NonNull Consumer<@NonNull WindowEngagementInfo> listener
)
```

Registers a `https://developer.android.com/reference/androidx/annotation/UiContext` listener to consume `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` values. If the same listener is registered twice then this method is a no-op.

This method can be long-running as it performs an initial check of all input devices. It is recommended to provide a background `https://developer.android.com/reference/java/util/concurrent/Executor.html` and call this method from a background coroutine context.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | a `https://developer.android.com/reference/androidx/annotation/UiContext` such as an `https://developer.android.com/reference/android/app/Activity.html`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | that the listener will invoke on. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/Consumer<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo> listener` | for `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` values. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowEngagementInfo(android.content.Context)` |   |

### registerWindowLayoutInfoListener

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

```
default void registerWindowLayoutInfoListener(
    @UiContext @NonNull Context context,
    @NonNull Executor executor,
    @NonNull Consumer<@NonNull WindowLayoutInfo> listener
)
```

Registers a `https://developer.android.com/reference/androidx/annotation/UiContext` listener to consume `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` values. If the same listener is registered twice then this method is a no-op.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | a `https://developer.android.com/reference/androidx/annotation/UiContext` such as an `https://developer.android.com/reference/android/app/Activity.html`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | that the listener will invoke on. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/Consumer<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo> listener` | for `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` values. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### unregisterWindowEngagementInfoListener

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

```
default void unregisterWindowEngagementInfoListener(
    @NonNull Consumer<@NonNull WindowEngagementInfo> listener
)
```

Unregister a listener to stop consuming `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` values. If the listener has already been removed then this is a no-op.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowEngagementInfo(android.content.Context)` |   |

### unregisterWindowLayoutInfoListener

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

```
default void unregisterWindowLayoutInfoListener(
    @NonNull Consumer<@NonNull WindowLayoutInfo> listener
)
```

Unregister a listener to stop consuming `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` values. If the listener has already been removed then this is a no-op.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### windowEngagementInfo

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

```
default @NonNull Flow<@NonNull WindowEngagementInfo> windowEngagementInfo(@UiContext @NonNull Context context)
```

A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` that contains the current engagement modes.

This method can be long-running as it performs an initial check of all input devices. It is recommended to collect this `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` on a background dispatcher.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | a `https://developer.android.com/reference/androidx/annotation/UiContext` such as an `https://developer.android.com/reference/android/app/Activity.html` or a WindowContext. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowEngagementInfo` |   |

### windowLayoutInfo

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

```
abstract @NonNull Flow<@NonNull WindowLayoutInfo> windowLayoutInfo(@NonNull Activity activity)
```

A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` that contains all the available features. A `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` contains a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/window/layout/DisplayFeature` that intersect the associated `https://developer.android.com/reference/android/view/Window.html`.

The first `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` will not be emitted until `https://developer.android.com/reference/android/app/Activity.html#onStart()` has been called. which values you receive and when is device dependent.

It is recommended to test the following scenarios since behaviors may differ between hardware implementations:

- Values are emitted immediately after subscribing to this function.

- There is a long delay between subscribing and receiving the first value.

- Never receiving a value after subscription.

Since the information is associated to the `https://developer.android.com/reference/android/app/Activity.html` you should not retain the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` across `https://developer.android.com/reference/android/app/Activity.html` recreations. Doing so can result in unpredictable behavior such as a memory leak or incorrect values for `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity` | an `https://developer.android.com/reference/android/app/Activity.html` that has not been destroyed. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` |   |
| `https://developer.android.com/reference/androidx/window/layout/DisplayFeature` |   |

### windowLayoutInfo

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

```
default @NonNull Flow<@NonNull WindowLayoutInfo> windowLayoutInfo(@UiContext @NonNull Context context)
```

A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` that contains all the available features. A `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` contains a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/window/layout/DisplayFeature` that intersect the associated `https://developer.android.com/reference/android/view/Window.html`.

This method exports the same content as the `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` method that accepts an `https://developer.android.com/reference/android/app/Activity.html` as a parameter, but also supports non-Activity windows to receive `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` updates. A `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` value should be published when `https://developer.android.com/reference/androidx/window/layout/DisplayFeature` have changed, but the behavior is ultimately decided by the hardware implementation. It is recommended to test the following scenarios:

- Values are emitted immediately after subscribing to this function.

- There is a long delay between subscribing and receiving the first value.

- Never receiving a value after subscription.

A derived class may throw NotImplementedError if this method is not overridden. Obtaining a `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker` through `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#getOrCreate(android.content.Context)` guarantees having a default implementation for this method.

If the passed `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` is not an `https://developer.android.com/reference/android/app/Activity.html` and `https://developer.android.com/reference/androidx/window/WindowSdkExtensions#extensionVersion()` is less than 2, the flow will return empty `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` list flow.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/UiContext @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | a `https://developer.android.com/reference/androidx/annotation/UiContext` such as an `https://developer.android.com/reference/android/app/Activity.html`, an `https://developer.android.com/reference/android/inputmethodservice/InputMethodService.html`, or an instance created via `https://developer.android.com/reference/android/content/Context.html#createWindowContext(android.view.Display, int, android.os.Bundle)` that listens to configuration changes. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | when `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` is not an `https://developer.android.com/reference/androidx/annotation/UiContext`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-not-implemented-error/index.html` | when this method has no supporting implementation. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo` |   |
| `https://developer.android.com/reference/androidx/window/layout/DisplayFeature` |   |

## Extension functions

### WindowInfoTrackerRx.windowLayoutInfoFlowable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoFlowable)

```
default final @NonNull Flowable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoFlowable(
    @NonNull WindowInfoTracker receiver,
    @NonNull Activity activity
)
```

Return a `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoFlowable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoFlowable)

```
default final @NonNull Flowable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoFlowable(
    @NonNull WindowInfoTracker receiver,
    @NonNull Activity activity
)
```

Return a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoFlowable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoFlowable)

```
default final @NonNull Flowable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoFlowable(
    @NonNull WindowInfoTracker receiver,
    @UiContext @NonNull Context context
)
```

Return a `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoFlowable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoFlowable)

```
default final @NonNull Flowable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoFlowable(
    @NonNull WindowInfoTracker receiver,
    @UiContext @NonNull Context context
)
```

Return a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Flowable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoObservable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoObservable)

```
default final @NonNull Observable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoObservable(
    @NonNull WindowInfoTracker receiver,
    @NonNull Activity activity
)
```

Return an `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoObservable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoObservable)

```
default final @NonNull Observable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoObservable(
    @NonNull WindowInfoTracker receiver,
    @NonNull Activity activity
)
```

Return an `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoObservable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoObservable)

```
default final @NonNull Observable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoObservable(
    @NonNull WindowInfoTracker receiver,
    @UiContext @NonNull Context context
)
```

Return an `https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |

### WindowInfoTrackerRx.windowLayoutInfoObservable

Artifact: [androidx.window:window-rxjava2](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/rxjava2/layout/WindowInfoTrackerRx.kt+function:windowLayoutInfoObservable)

```
default final @NonNull Observable<@NonNull WindowLayoutInfo> WindowInfoTrackerRx.windowLayoutInfoObservable(
    @NonNull WindowInfoTracker receiver,
    @UiContext @NonNull Context context
)
```

Return an `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Observable.html` stream of `https://developer.android.com/reference/androidx/window/layout/WindowLayoutInfo`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/layout/WindowInfoTracker#windowLayoutInfo(android.content.Context)` |   |