Added in API level 29

WindowInspector


class WindowInspector
kotlin.Any
   ↳ android.view.inspector.WindowInspector

Provides access to window inspection information.

Summary

Public methods
static Unit

Adds a listener that is notified whenever the value of getGlobalWindowViews() changes.

static MutableList<View!>

static Unit

Removes a listener from getting notifications of global window views changes.

Public methods

addGlobalWindowViewsListener

static fun addGlobalWindowViewsListener(
    executor: Executor,
    consumer: Consumer<MutableList<View!>!>
): Unit

Adds a listener that is notified whenever the value of getGlobalWindowViews() changes. The current value is provided immediately using the provided Executor. The value is initially relayed using the main thread and then posted to the Executor. Using a direct Executor and doing heavy calculations can cause performance issues. If this Consumer is already registered, then this method is a no op.

Parameters
executor Executor: This value cannot be null.
consumer Consumer<MutableList<View!>!>: This value cannot be null.

getGlobalWindowViews

Added in API level 29
static fun getGlobalWindowViews(): MutableList<View!>
Return
MutableList<View!> the list of all window views attached to the current process This value cannot be null.

removeGlobalWindowViewsListener

static fun removeGlobalWindowViewsListener(consumer: Consumer<MutableList<View!>!>): Unit

Removes a listener from getting notifications of global window views changes. If the Consumer is not registered this method is a no op.

Parameters
consumer Consumer<MutableList<View!>!>: This value cannot be null.