Android APIs
public final class

AccessibilityWindowInfo

extends Object
implements Parcelable
java.lang.Object
   ↳ android.view.accessibility.AccessibilityWindowInfo

Class Overview

This class represents a state snapshot of a window for accessibility purposes. The screen content contains one or more windows where some windows can be descendants of other windows, which is the windows are hierarchically ordered. Note that there is no root window. Hence, the screen content can be seen as a collection of window trees.

Summary

Constants
int TYPE_ACCESSIBILITY_OVERLAY Window type: Windows that are overlaid only by an AccessibilityService for interception of user interactions without changing the windows an accessibility service can introspect.
int TYPE_APPLICATION Window type: This is an application window.
int TYPE_INPUT_METHOD Window type: This is an input method window.
int TYPE_SYSTEM Window type: This is an system window.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<AccessibilityWindowInfo> CREATOR
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
boolean equals(Object obj)
Compares this instance with the specified object and indicates if they are equal.
void getBoundsInScreen(Rect outBounds)
Gets the bounds of this window in the screen.
AccessibilityWindowInfo getChild(int index)
Gets the child window at a given index.
int getChildCount()
Gets the number of child windows.
int getId()
Gets the unique window id.
int getLayer()
Gets the layer which determines the Z-order of the window.
AccessibilityWindowInfo getParent()
Gets the parent window if such.
AccessibilityNodeInfo getRoot()
Gets the root node in the window's hierarchy.
int getType()
Gets the type of the window.
int hashCode()
Returns an integer hash code for this object.
boolean isAccessibilityFocused()
Gets if this window has accessibility focus.
boolean isActive()
Gets if this window is active.
boolean isFocused()
Gets if this window has input focus.
static AccessibilityWindowInfo obtain(AccessibilityWindowInfo info)
Returns a cached instance if such is available or a new one is created.
static AccessibilityWindowInfo obtain()
Returns a cached instance if such is available or a new one is created.
void recycle()
Return an instance back to be reused.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel parcel, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int TYPE_ACCESSIBILITY_OVERLAY

Window type: Windows that are overlaid only by an AccessibilityService 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.

Constant Value: 4 (0x00000004)

public static final int TYPE_APPLICATION

Added in API level 21

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

Constant Value: 1 (0x00000001)

public static final int TYPE_INPUT_METHOD

Added in API level 21

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

Constant Value: 2 (0x00000002)

public static final int TYPE_SYSTEM

Added in API level 21

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

Constant Value: 3 (0x00000003)

Fields

public static final Creator<AccessibilityWindowInfo> CREATOR

Added in API level 21

Public Methods

public int describeContents ()

Added in API level 21

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public boolean equals (Object obj)

Added in API level 21

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
obj the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public void getBoundsInScreen (Rect outBounds)

Added in API level 21

Gets the bounds of this window in the screen.

Parameters
outBounds The out window bounds.

public AccessibilityWindowInfo getChild (int index)

Added in API level 21

Gets the child window at a given index.

Parameters
index The index.
Returns
  • The child.

public int getChildCount ()

Added in API level 21

Gets the number of child windows.

Returns
  • The child count.

public int getId ()

Added in API level 21

Gets the unique window id.

Returns
  • windowId The window id.

public int getLayer ()

Added in API level 21

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

Returns
  • The window layer.

public AccessibilityWindowInfo getParent ()

Added in API level 21

Gets the parent window if such.

Returns
  • The parent window.

public AccessibilityNodeInfo getRoot ()

Added in API level 21

Gets the root node in the window's hierarchy.

Returns
  • The root node.

public int getType ()

Added in API level 21

Gets the type of the window.

Returns
  • The type.

public int hashCode ()

Added in API level 21

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public boolean isAccessibilityFocused ()

Added in API level 21

Gets if this window has accessibility focus.

Returns
  • Whether has accessibility focus.

public boolean isActive ()

Added in API level 21

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
  • Whether this is the active window.

public boolean isFocused ()

Added in API level 21

Gets if this window has input focus.

Returns
  • Whether has input focus.

public static AccessibilityWindowInfo obtain (AccessibilityWindowInfo info)

Added in API level 21

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

Parameters
info The other info.
Returns
  • An instance.

public static AccessibilityWindowInfo obtain ()

Added in API level 21

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

Returns
  • An instance.

public void recycle ()

Added in API level 21

Return an instance back to be reused.

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

Throws
IllegalStateException If the info is already recycled.

public String toString ()

Added in API level 21

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel parcel, int flags)

Added in API level 21

Flatten this object in to a Parcel.

Parameters
parcel The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.