Fields Summary |
---|
private static final boolean | DEBUG |
public static final int | TYPE_APPLICATIONWindow type: This is an application window. Such a window shows UI for
interacting with an application. |
public static final int | TYPE_INPUT_METHODWindow type: This is an input method window. Such a window shows UI for
inputting text such as keyboard, suggestions, etc. |
public static final int | TYPE_SYSTEMWindow type: This is an system window. Such a window shows UI for
interacting with the system. |
public static final int | TYPE_ACCESSIBILITY_OVERLAYWindow type: Windows that are overlaid only by an {@link
android.accessibilityservice.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. |
private static final int | UNDEFINED |
private static final int | BOOLEAN_PROPERTY_ACTIVE |
private static final int | BOOLEAN_PROPERTY_FOCUSED |
private static final int | BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED |
private static final int | MAX_POOL_SIZE |
private static final android.util.Pools.SynchronizedPool | sPool |
private int | mType |
private int | mLayer |
private int | mBooleanProperties |
private int | mId |
private int | mParentId |
private final android.graphics.Rect | mBoundsInScreen |
private android.util.LongArray | mChildIds |
private int | mConnectionId |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
public void | addChild(int childId)Adds a child window.
if (mChildIds == null) {
mChildIds = new LongArray();
}
mChildIds.add(childId);
|
public boolean | changed(android.view.accessibility.AccessibilityWindowInfo other)Checks whether this window changed. The argument should be
another state of the same window, which is have the same id
and type as they never change.
if (other.mId != mId) {
throw new IllegalArgumentException("Not same window.");
}
if (other.mType != mType) {
throw new IllegalArgumentException("Not same type.");
}
if (!mBoundsInScreen.equals(mBoundsInScreen)) {
return true;
}
if (mLayer != other.mLayer) {
return true;
}
if (mBooleanProperties != other.mBooleanProperties) {
return true;
}
if (mParentId != other.mParentId) {
return true;
}
if (mChildIds == null) {
if (other.mChildIds != null) {
return true;
}
} else if (!mChildIds.equals(other.mChildIds)) {
return true;
}
return false;
|
private void | clear()Clears the internal state.
mType = UNDEFINED;
mLayer = UNDEFINED;
mBooleanProperties = 0;
mId = UNDEFINED;
mParentId = UNDEFINED;
mBoundsInScreen.setEmpty();
if (mChildIds != null) {
mChildIds.clear();
}
mConnectionId = UNDEFINED;
|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object obj)
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AccessibilityWindowInfo other = (AccessibilityWindowInfo) obj;
return (mId == other.mId);
|
private boolean | getBooleanProperty(int property)Gets the value of a boolean property.
return (mBooleanProperties & property) != 0;
|
public void | getBoundsInScreen(android.graphics.Rect outBounds)Gets the bounds of this window in the screen.
outBounds.set(mBoundsInScreen);
|
public android.view.accessibility.AccessibilityWindowInfo | getChild(int index)Gets the child window at a given index.
if (mChildIds == null) {
throw new IndexOutOfBoundsException();
}
if (mConnectionId == UNDEFINED) {
return null;
}
final int childId = (int) mChildIds.get(index);
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
return client.getWindow(mConnectionId, childId);
|
public int | getChildCount()Gets the number of child windows.
return (mChildIds != null) ? mChildIds.size() : 0;
|
public int | getId()Gets the unique window id.
return mId;
|
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.
return mLayer;
|
public android.view.accessibility.AccessibilityWindowInfo | getParent()Gets the parent window if such.
if (mConnectionId == UNDEFINED || mParentId == UNDEFINED) {
return null;
}
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
return client.getWindow(mConnectionId, mParentId);
|
public AccessibilityNodeInfo | getRoot()Gets the root node in the window's hierarchy.
if (mConnectionId == UNDEFINED) {
return null;
}
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId,
mId, AccessibilityNodeInfo.ROOT_NODE_ID,
true, AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS);
|
public int | getType()Gets the type of the window.
return mType;
|
public int | hashCode()
return mId;
|
private void | initFromParcel(android.os.Parcel parcel)
mType = parcel.readInt();
mLayer = parcel.readInt();
mBooleanProperties = parcel.readInt();
mId = parcel.readInt();
mParentId = parcel.readInt();
mBoundsInScreen.readFromParcel(parcel);
final int childCount = parcel.readInt();
if (childCount > 0) {
if (mChildIds == null) {
mChildIds = new LongArray(childCount);
}
for (int i = 0; i < childCount; i++) {
final int childId = parcel.readInt();
mChildIds.add(childId);
}
}
mConnectionId = parcel.readInt();
|
public boolean | isAccessibilityFocused()Gets if this window has accessibility focus.
return getBooleanProperty(BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED);
|
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.
return getBooleanProperty(BOOLEAN_PROPERTY_ACTIVE);
|
public boolean | isFocused()Gets if this window has input focus.
return getBooleanProperty(BOOLEAN_PROPERTY_FOCUSED);
|
public static android.view.accessibility.AccessibilityWindowInfo | obtain()Returns a cached instance if such is available or a new one is
created.
AccessibilityWindowInfo info = sPool.acquire();
if (info == null) {
info = new AccessibilityWindowInfo();
}
return info;
|
public static android.view.accessibility.AccessibilityWindowInfo | obtain(android.view.accessibility.AccessibilityWindowInfo info)Returns a cached instance if such is available or a new one is
created. The returned instance is initialized from the given
info .
AccessibilityWindowInfo infoClone = obtain();
infoClone.mType = info.mType;
infoClone.mLayer = info.mLayer;
infoClone.mBooleanProperties = info.mBooleanProperties;
infoClone.mId = info.mId;
infoClone.mParentId = info.mParentId;
infoClone.mBoundsInScreen.set(info.mBoundsInScreen);
if (info.mChildIds != null && info.mChildIds.size() > 0) {
if (infoClone.mChildIds == null) {
infoClone.mChildIds = info.mChildIds.clone();
} else {
infoClone.mChildIds.addAll(info.mChildIds);
}
}
infoClone.mConnectionId = info.mConnectionId;
return infoClone;
|
public void | recycle()Return an instance back to be reused.
Note: You must not touch the object after calling this function.
clear();
sPool.release(this);
|
public void | setAccessibilityFocused(boolean focused)Sets if this window has accessibility focus.
setBooleanProperty(BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED, focused);
|
public void | setActive(boolean active)Sets if this window is active, which is this is the window
the user is currently touching or the window has input focus
and the user is not touching any window.
setBooleanProperty(BOOLEAN_PROPERTY_ACTIVE, active);
|
private void | setBooleanProperty(int property, boolean value)Sets a boolean property.
if (value) {
mBooleanProperties |= property;
} else {
mBooleanProperties &= ~property;
}
|
public void | setBoundsInScreen(android.graphics.Rect bounds)Sets the bounds of this window in the screen.
mBoundsInScreen.set(bounds);
|
public void | setConnectionId(int connectionId)Sets the unique id of the IAccessibilityServiceConnection over which
this instance can send requests to the system.
mConnectionId = connectionId;
|
public void | setFocused(boolean focused)Sets if this window has input focus.
setBooleanProperty(BOOLEAN_PROPERTY_FOCUSED, focused);
|
public void | setId(int id)Sets the unique window id.
mId = id;
|
public void | setLayer(int layer)Sets the layer which determines the Z-order of the window. Windows
with greater layer appear on top of windows with lesser layer.
mLayer = layer;
|
public void | setParentId(int parentId)Sets the parent window id.
mParentId = parentId;
|
public void | setType(int type)Sets the type of the window.
mType = type;
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder();
builder.append("AccessibilityWindowInfo[");
builder.append("id=").append(mId);
builder.append(", type=").append(typeToString(mType));
builder.append(", layer=").append(mLayer);
builder.append(", bounds=").append(mBoundsInScreen);
builder.append(", focused=").append(isFocused());
builder.append(", active=").append(isActive());
if (DEBUG) {
builder.append(", parent=").append(mParentId);
builder.append(", children=[");
if (mChildIds != null) {
final int childCount = mChildIds.size();
for (int i = 0; i < childCount; i++) {
builder.append(mChildIds.get(i));
if (i < childCount - 1) {
builder.append(',");
}
}
} else {
builder.append("null");
}
builder.append(']");
} else {
builder.append(", hasParent=").append(mParentId != UNDEFINED);
builder.append(", hasChildren=").append(mChildIds != null
&& mChildIds.size() > 0);
}
builder.append(']");
return builder.toString();
|
private static java.lang.String | typeToString(int type)
switch (type) {
case TYPE_APPLICATION: {
return "TYPE_APPLICATION";
}
case TYPE_INPUT_METHOD: {
return "TYPE_INPUT_METHOD";
}
case TYPE_SYSTEM: {
return "TYPE_SYSTEM";
}
case TYPE_ACCESSIBILITY_OVERLAY: {
return "TYPE_ACCESSIBILITY_OVERLAY";
}
default:
return "<UNKNOWN>";
}
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeInt(mType);
parcel.writeInt(mLayer);
parcel.writeInt(mBooleanProperties);
parcel.writeInt(mId);
parcel.writeInt(mParentId);
mBoundsInScreen.writeToParcel(parcel, flags);
final LongArray childIds = mChildIds;
if (childIds == null) {
parcel.writeInt(0);
} else {
final int childCount = childIds.size();
parcel.writeInt(childCount);
for (int i = 0; i < childCount; i++) {
parcel.writeInt((int) childIds.get(i));
}
}
parcel.writeInt(mConnectionId);
|