API reference

WindowLifecycle Interface

Lifecycle phase of a window emitted by SpatialWindow. Observe via WindowState.lifecycle to react to the window coming online, recovering from transient failures, or terminating.
Transitions follow this flow:
Idle     → Adding            (window declaration enters composition)
Adding   → Active            (platform placement succeeds)
Adding   → Failure.Transient (placement fails with a retryable code; another attempt remains)
Failure.Transient → Adding   (next attempt begins)
Adding   → Failure.Rejected  (placement fails terminally — non-retryable, or attempts exhausted)
Adding   → Pending           (no slot — out-prioritized by the windows holding the slots)
Pending  → Adding            (a slot opened for this window)
Active   → Preempted         (demoted so a higher-priority window can take its slot)
Preempted → Adding           (a slot opened — re-placed)
Active   → Removing          (window declaration leaves composition)
Removing → Removed           (cleanup complete)
Active   → ExternallyRemoved (dismissed by the user or removed by the system, not the app)

Failure variants share code, message, and windowKey via the nested WindowLifecycle.Failure interface, so a single is Failure check surfaces every error while is Failure.Rejected narrows to terminal ones. WindowLifecycle.Pending and WindowLifecycle.Preempted are distinct from WindowLifecycle.Failure: neither is an error, just a window held for capacity or priority that the SDK places automatically once it wins a slot. WindowLifecycle.ExternallyRemoved is the terminal "someone else closed it" signal.

Signature

interface WindowLifecycle

Inner Objects

Idle Object

Initial phase before the SDK has attempted to place the window.

Signature

object Idle : WindowLifecycle

Adding Object

A placement attempt is in flight; the platform has not yet responded.

Signature

object Adding : WindowLifecycle

Active Object

The window has been placed and its content is rendering.

Signature

object Active : WindowLifecycle

Pending Object

The window is registered but not currently placed — no slot is free for its priority. Not an error: the SDK places it automatically once it wins a slot. This is the observable "your content is held, waiting for room" signal.

Signature

object Pending : WindowLifecycle

Preempted Object

The window was WindowLifecycle.Active but got demoted to free its slot for a higher-priority window. Distinct from WindowLifecycle.Pending (which was never placed) so observers can tell "waiting for room" apart from "we pulled it for something more important." The SDK re-places it once it wins a slot again.

Signature

object Preempted : WindowLifecycle

Removing Object

The window declaration has left composition; the SDK is removing the window.

Signature

object Removing : WindowLifecycle

Removed Object

The window has been fully removed and its resources released.

Signature

object Removed : WindowLifecycle

ExternallyRemoved Object

The window was removed externally — dismissed by the user (e.g. via the system's window control bar) or removed by the system — rather than by the app un-declaring it. Terminal: the SDK will not re-place it. This is the observable "someone else closed your window" signal; observe it to reconcile app state (for example, stop declaring the window).

Signature

object ExternallyRemoved : WindowLifecycle

Inner Interface

Failure Interface

Extends WindowLifecycle
Placement failure. WindowLifecycle.Failure.Transient may still succeed on a subsequent attempt; WindowLifecycle.Failure.Rejected is terminal.

Signature

interface Failure : WindowLifecycle

Properties

code : Int
[Get]
Platform error code reported by the placement attempt. See VwmError.
Signature
abstract val code: Int
message : String
[Get]
Human-readable error description from the platform.
Signature
abstract val message: String
windowKey : String
[Get]
Key of the window that failed.
Signature
abstract val windowKey: String

Inner Classes

Transient Class
Implements WindowLifecycle.Failure
Retryable failure — the SDK re-attempts placement immediately (no backoff), up to a fixed number of attempts. WindowLifecycle.Failure.Transient.attempt is the number of the upcoming attempt (1-based).
Signature
data class Transient(val code: Int, val message: String, val windowKey: String, val attempt: Int) :
    WindowLifecycle.Failure
Constructors
Transient ( code , message , windowKey , attempt )
Signature
constructor(code: Int, message: String, windowKey: String, attempt: Int)
Parameters
code: Int
message: String
windowKey: String
attempt: Int
Returns
WindowLifecycle.Failure.Transient
Properties
attempt : Int
[Get]
Signature
val attempt: Int
code : Int
[Get]
Platform error code reported by the placement attempt. See VwmError.
Signature
open override val code: Int
message : String
[Get]
Human-readable error description from the platform.
Signature
open override val message: String
windowKey : String
[Get]
Key of the window that failed.
Signature
open override val windowKey: String
Rejected Class
Implements WindowLifecycle.Failure
Terminal failure — either the error code is non-retryable, or all attempts were used.
Signature
data class Rejected(val code: Int, val message: String, val windowKey: String) :
    WindowLifecycle.Failure
Constructors
Rejected ( code , message , windowKey )
Signature
constructor(code: Int, message: String, windowKey: String)
Parameters
code: Int
message: String
windowKey: String
Returns
WindowLifecycle.Failure.Rejected
Properties
code : Int
[Get]
Platform error code reported by the placement attempt. See VwmError.
Signature
open override val code: Int
message : String
[Get]
Human-readable error description from the platform.
Signature
open override val message: String
windowKey : String
[Get]
Key of the window that failed.
Signature
open override val windowKey: String