Added in API level 29

WindowInspector


public final class WindowInspector
extends Object

java.lang.Object
   ↳ android.view.inspector.WindowInspector


Provides access to window inspection information.

Summary

Public methods

static void addGlobalWindowViewsListener(Executor executor, Consumer<List<View>> consumer)

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

static List<View> getGlobalWindowViews()
static void removeGlobalWindowViewsListener(Consumer<List<View>> consumer)

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

Inherited methods

Public methods

addGlobalWindowViewsListener

public static void addGlobalWindowViewsListener (Executor executor, 
                Consumer<List<View>> consumer)

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: This value cannot be null.

getGlobalWindowViews

Added in API level 29
public static List<View> getGlobalWindowViews ()

Returns
List<View> the list of all window views attached to the current process This value cannot be null.

removeGlobalWindowViewsListener

public static void removeGlobalWindowViewsListener (Consumer<List<View>> consumer)

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: This value cannot be null.