AccessibilityWindowInfoCompat

Added in 1.1.0

public class AccessibilityWindowInfoCompat


Helper for accessing android.view.accessibility.AccessibilityWindowInfo.

Summary

Constants

static final int

Window type: Windows that are overlaid only by an for interception of user interactions without changing the windows an accessibility service can introspect.

static final int

Window type: This is an application window.

static final int

Window type: This is an input method window.

static final int

Window type: A system window used to show the UI for the interaction with window-based magnification, which includes the magnified content and the option menu.

static final int

Window type: A system window used to divide the screen in split-screen mode.

static final int

Window type: This is an system window.

Public constructors

Creates a new AccessibilityWindowInfoCompat.

Public methods

boolean
@Nullable AccessibilityNodeInfoCompat

Gets the node that anchors this window to another.

void

Gets the bounds of this window in the screen.

@Nullable AccessibilityWindowInfoCompat
getChild(int index)

Gets the child window at a given index.

int

Gets the number of child windows.

int

Returns the ID of the display this window is on, for use with getDisplay.

int

Gets the unique window id.

int

Gets the layer which determines the Z-order of the window.

@NonNull LocaleListCompat

Returns the android.os.LocaleList of the window.

@Nullable AccessibilityWindowInfoCompat

Gets the parent window if such.

void

Gets the touchable region of this window in the screen.

@Nullable AccessibilityNodeInfoCompat

Gets the root node in the window's hierarchy.

@Nullable AccessibilityNodeInfoCompat
getRoot(int prefetchingStrategy)

Gets the root node in the window's hierarchy.

@Nullable CharSequence

Gets the title of the window.

long

Returns the uptimeMillis at which the last transition happens.

int

Gets the type of the window.

int
boolean

Gets if this window has accessibility focus.

boolean

Gets if this window is active.

boolean

Gets if this window has input focus.

boolean

Check if the window is in picture-in-picture mode.

static @Nullable AccessibilityWindowInfoCompat

Returns a cached instance if such is available or a new one is created.

static @Nullable AccessibilityWindowInfoCompat

Returns a cached instance if such is available or a new one is created.

void

This method is deprecated.

Accessibility Object recycling is no longer necessary or functional.

@NonNull String
@Nullable AccessibilityWindowInfo

Constants

TYPE_ACCESSIBILITY_OVERLAY

Added in 1.1.0
public static final int TYPE_ACCESSIBILITY_OVERLAY = 4

Window type: Windows that are overlaid only by an for interception of user interactions without changing the windows an accessibility service can introspect. In particular, an accessibility service can introspect only windows that a sighted user can interact with which they can touch these windows or can type into these windows. For example, if there is a full screen accessibility overlay that is touchable, the windows below it will be introspectable by an accessibility service regardless they are covered by a touchable window.

TYPE_APPLICATION

Added in 1.1.0
public static final int TYPE_APPLICATION = 1

Window type: This is an application window. Such a window shows UI for interacting with an application.

TYPE_INPUT_METHOD

Added in 1.1.0
public static final int TYPE_INPUT_METHOD = 2

Window type: This is an input method window. Such a window shows UI for inputting text such as keyboard, suggestions, etc.

TYPE_MAGNIFICATION_OVERLAY

Added in 1.12.0
public static final int TYPE_MAGNIFICATION_OVERLAY = 6

Window type: A system window used to show the UI for the interaction with window-based magnification, which includes the magnified content and the option menu.

TYPE_SPLIT_SCREEN_DIVIDER

Added in 1.1.0
public static final int TYPE_SPLIT_SCREEN_DIVIDER = 5

Window type: A system window used to divide the screen in split-screen mode. This type of window is present only in split-screen mode.

TYPE_SYSTEM

Added in 1.1.0
public static final int TYPE_SYSTEM = 3

Window type: This is an system window. Such a window shows UI for interacting with the system.

Public constructors

AccessibilityWindowInfoCompat

Added in 1.12.0
public AccessibilityWindowInfoCompat()

Creates a new AccessibilityWindowInfoCompat.

Compatibility:

Public methods

equals

public boolean equals(Object obj)

getAnchor

Added in 1.1.0
public @Nullable AccessibilityNodeInfoCompat getAnchor()

Gets the node that anchors this window to another.

Returns
@Nullable AccessibilityNodeInfoCompat

The anchor node, or null if none exists.

getBoundsInScreen

Added in 1.1.0
public void getBoundsInScreen(@NonNull Rect outBounds)

Gets the bounds of this window in the screen.

Compatibility:

  • API <21: Does not operate.
Parameters
@NonNull Rect outBounds

The out window bounds.

getChild

Added in 1.1.0
public @Nullable AccessibilityWindowInfoCompat getChild(int index)

Gets the child window at a given index.

Parameters
int index

The index.

getChildCount

Added in 1.1.0
public int getChildCount()

Gets the number of child windows.

Returns
int

The child count.

getDisplayId

Added in 1.9.0
public int getDisplayId()

Returns the ID of the display this window is on, for use with getDisplay.

Compatibility:

  • Api <33: Will return android.view.Display.DEFAULT_DISPLAY.
Returns
int

the logical display id.

getId

Added in 1.1.0
public int getId()

Gets the unique window id.

Returns
int

windowId The window id.

getLayer

Added in 1.1.0
public int getLayer()

Gets the layer which determines the Z-order of the window. Windows with greater layer appear on top of windows with lesser layer.

Returns
int

The window layer.

getLocales

Added in 1.12.0
public @NonNull LocaleListCompat getLocales()

Returns the android.os.LocaleList of the window.

Compatibility:

Returns
@NonNull LocaleListCompat

the locales of the window.

getParent

Added in 1.1.0
public @Nullable AccessibilityWindowInfoCompat getParent()

Gets the parent window if such.

Returns
@Nullable AccessibilityWindowInfoCompat

The parent window.

getRegionInScreen

Added in 1.9.0
public void getRegionInScreen(@NonNull Region outRegion)

Gets the touchable region of this window in the screen.

Compatibility:

  • API <33: Gets the bounds of this window in the screen.
  • API <21: Does not operate.
Parameters
@NonNull Region outRegion

The out window region.

getRoot

Added in 1.1.0
public @Nullable AccessibilityNodeInfoCompat getRoot()

Gets the root node in the window's hierarchy.

Returns
@Nullable AccessibilityNodeInfoCompat

The root node.

getRoot

Added in 1.12.0
public @Nullable AccessibilityNodeInfoCompat getRoot(int prefetchingStrategy)

Gets the root node in the window's hierarchy.

Parameters
int prefetchingStrategy

the prefetching strategy.

Returns
@Nullable AccessibilityNodeInfoCompat

The root node.

See also
getParent

for a description of prefetching.

getTitle

Added in 1.1.0
public @Nullable CharSequence getTitle()

Gets the title of the window.

Returns
@Nullable CharSequence

The title of the window, or the application label for the window if no title was explicitly set, or null if neither is available.

getTransitionTimeMillis

Added in 1.12.0
public long getTransitionTimeMillis()

Returns the uptimeMillis at which the last transition happens. A transition happens when getBoundsInScreen is changed.

Compatibility:

  • Api <34: Will return 0.
Returns
long

The transition timestamp.

getType

Added in 1.1.0
public int getType()

Gets the type of the window.

Returns
int

The type.

hashCode

public int hashCode()

isAccessibilityFocused

Added in 1.1.0
public boolean isAccessibilityFocused()

Gets if this window has accessibility focus.

Returns
boolean

Whether has accessibility focus.

isActive

Added in 1.1.0
public boolean isActive()

Gets if this window is active. An active window is the one the user is currently touching or the window has input focus and the user is not touching any window.

Returns
boolean

Whether this is the active window.

isFocused

Added in 1.1.0
public boolean isFocused()

Gets if this window has input focus.

Returns
boolean

Whether has input focus.

isInPictureInPictureMode

Added in 1.9.0
public boolean isInPictureInPictureMode()

Check if the window is in picture-in-picture mode.

Compatibility:

  • API <26: Returns false.
Returns
boolean

true if the window is in picture-in-picture mode, false otherwise.

obtain

Added in 1.1.0
public static @Nullable AccessibilityWindowInfoCompat obtain()

Returns a cached instance if such is available or a new one is created.

Returns
@Nullable AccessibilityWindowInfoCompat

An instance.

obtain

Added in 1.1.0
public static @Nullable AccessibilityWindowInfoCompat obtain(@Nullable AccessibilityWindowInfoCompat info)

Returns a cached instance if such is available or a new one is created. The returned instance is initialized from the given info.

Parameters
@Nullable AccessibilityWindowInfoCompat info

The other info.

Returns
@Nullable AccessibilityWindowInfoCompat

An instance.

recycle

Added in 1.1.0
Deprecated in 1.10.0
public void recycle()

Return an instance back to be reused.

Note: You must not touch the object after calling this function.

toString

public @NonNull String toString()