Methods Summary |
---|
void | clear()Clears the state of this instance.
mSealed = false;
mBooleanProperties = 0;
mCurrentItemIndex = UNDEFINED;
mItemCount = UNDEFINED;
mFromIndex = UNDEFINED;
mToIndex = UNDEFINED;
mScrollX = UNDEFINED;
mScrollY = UNDEFINED;
mMaxScrollX = UNDEFINED;
mMaxScrollY = UNDEFINED;
mAddedCount = UNDEFINED;
mRemovedCount = UNDEFINED;
mClassName = null;
mContentDescription = null;
mBeforeText = null;
mParcelableData = null;
mText.clear();
mSourceNodeId = AccessibilityNodeInfo.makeNodeId(UNDEFINED, UNDEFINED);
mSourceWindowId = UNDEFINED;
mConnectionId = UNDEFINED;
|
void | enforceNotSealed()Enforces that this instance is not sealed.
if (isSealed()) {
throw new IllegalStateException("Cannot perform this "
+ "action on a sealed instance.");
}
|
void | enforceSealed()Enforces that this instance is sealed.
if (!isSealed()) {
throw new IllegalStateException("Cannot perform this "
+ "action on a not sealed instance.");
}
|
public int | getAddedCount()Gets the number of added characters.
return mAddedCount;
|
public java.lang.CharSequence | getBeforeText()Sets the text before a change.
return mBeforeText;
|
private boolean | getBooleanProperty(int property)Gets the value of a boolean property.
return (mBooleanProperties & property) == property;
|
public java.lang.CharSequence | getClassName()Gets the class name of the source.
return mClassName;
|
public java.lang.CharSequence | getContentDescription()Gets the description of the source.
return mContentDescription;
|
public int | getCurrentItemIndex()Gets the index of the source in the list of items the can be visited.
return mCurrentItemIndex;
|
public int | getFromIndex()Gets the index of the first character of the changed sequence,
or the beginning of a text selection or the index of the first
visible item when scrolling.
return mFromIndex;
|
public int | getItemCount()Gets the number of items that can be visited.
return mItemCount;
|
public int | getMaxScrollX()Gets the max scroll offset of the source left edge in pixels.
return mMaxScrollX;
|
public int | getMaxScrollY()Gets the max scroll offset of the source top edge in pixels.
return mMaxScrollY;
|
public android.os.Parcelable | getParcelableData()Gets the {@link Parcelable} data.
return mParcelableData;
|
public int | getRemovedCount()Gets the number of removed characters.
return mRemovedCount;
|
public int | getScrollX()Gets the scroll offset of the source left edge in pixels.
return mScrollX;
|
public int | getScrollY()Gets the scroll offset of the source top edge in pixels.
return mScrollY;
|
public AccessibilityNodeInfo | getSource()Gets the {@link AccessibilityNodeInfo} of the event source.
Note: It is a client responsibility to recycle the received info
by calling {@link AccessibilityNodeInfo#recycle() AccessibilityNodeInfo#recycle()}
to avoid creating of multiple instances.
enforceSealed();
if (mConnectionId == UNDEFINED || mSourceWindowId == UNDEFINED
|| AccessibilityNodeInfo.getAccessibilityViewId(mSourceNodeId) == UNDEFINED) {
return null;
}
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, mSourceWindowId,
mSourceNodeId, false, GET_SOURCE_PREFETCH_FLAGS);
|
public long | getSourceNodeId()Gets the id of the source node.
return mSourceNodeId;
|
public java.util.List | getText()Gets the text of the event. The index in the list represents the priority
of the text. Specifically, the lower the index the higher the priority.
return mText;
|
public int | getToIndex()Gets the index of text selection end or the index of the last
visible item when scrolling.
return mToIndex;
|
public int | getWindowId()Gets the id of the window from which the event comes from.
return mSourceWindowId;
|
void | init(android.view.accessibility.AccessibilityRecord record)Initialize this record from another one.
mSealed = record.mSealed;
mBooleanProperties = record.mBooleanProperties;
mCurrentItemIndex = record.mCurrentItemIndex;
mItemCount = record.mItemCount;
mFromIndex = record.mFromIndex;
mToIndex = record.mToIndex;
mScrollX = record.mScrollX;
mScrollY = record.mScrollY;
mMaxScrollX = record.mMaxScrollX;
mMaxScrollY = record.mMaxScrollY;
mAddedCount = record.mAddedCount;
mRemovedCount = record.mRemovedCount;
mClassName = record.mClassName;
mContentDescription = record.mContentDescription;
mBeforeText = record.mBeforeText;
mParcelableData = record.mParcelableData;
mText.addAll(record.mText);
mSourceWindowId = record.mSourceWindowId;
mSourceNodeId = record.mSourceNodeId;
mConnectionId = record.mConnectionId;
|
public boolean | isChecked()Gets if the source is checked.
return getBooleanProperty(PROPERTY_CHECKED);
|
public boolean | isEnabled()Gets if the source is enabled.
return getBooleanProperty(PROPERTY_ENABLED);
|
public boolean | isFullScreen()Gets if the source is taking the entire screen.
return getBooleanProperty(PROPERTY_FULL_SCREEN);
|
public boolean | isImportantForAccessibility()Gets if the source is important for accessibility.
Note: Used only internally to determine whether
to deliver the event to a given accessibility service since some
services may want to regard all views for accessibility while others
may want to regard only the important views for accessibility.
return getBooleanProperty(PROPERTY_IMPORTANT_FOR_ACCESSIBILITY);
|
public boolean | isPassword()Gets if the source is a password field.
return getBooleanProperty(PROPERTY_PASSWORD);
|
public boolean | isScrollable()Gets if the source is scrollable.
return getBooleanProperty(PROPERTY_SCROLLABLE);
|
boolean | isSealed()Gets if this instance is sealed.
return mSealed;
|
public static android.view.accessibility.AccessibilityRecord | obtain(android.view.accessibility.AccessibilityRecord record)Returns a cached instance if such is available or a new one is
instantiated. The instance is initialized with data from the
given record.
AccessibilityRecord clone = AccessibilityRecord.obtain();
clone.init(record);
return clone;
|
public static android.view.accessibility.AccessibilityRecord | obtain()Returns a cached instance if such is available or a new one is
instantiated.
synchronized (sPoolLock) {
if (sPool != null) {
AccessibilityRecord record = sPool;
sPool = sPool.mNext;
sPoolSize--;
record.mNext = null;
record.mIsInPool = false;
return record;
}
return new AccessibilityRecord();
}
|
public void | recycle()Return an instance back to be reused.
Note: You must not touch the object after calling this function.
if (mIsInPool) {
throw new IllegalStateException("Record already recycled!");
}
clear();
synchronized (sPoolLock) {
if (sPoolSize <= MAX_POOL_SIZE) {
mNext = sPool;
sPool = this;
mIsInPool = true;
sPoolSize++;
}
}
|
public void | setAddedCount(int addedCount)Sets the number of added characters.
enforceNotSealed();
mAddedCount = addedCount;
|
public void | setBeforeText(java.lang.CharSequence beforeText)Sets the text before a change.
enforceNotSealed();
mBeforeText = beforeText;
|
private void | setBooleanProperty(int property, boolean value)Sets a boolean property.
if (value) {
mBooleanProperties |= property;
} else {
mBooleanProperties &= ~property;
}
|
public void | setChecked(boolean isChecked)Sets if the source is checked.
enforceNotSealed();
setBooleanProperty(PROPERTY_CHECKED, isChecked);
|
public void | setClassName(java.lang.CharSequence className)Sets the class name of the source.
enforceNotSealed();
mClassName = className;
|
public void | setConnectionId(int connectionId)Sets the unique id of the IAccessibilityServiceConnection over which
this instance can send requests to the system.
enforceNotSealed();
mConnectionId = connectionId;
|
public void | setContentDescription(java.lang.CharSequence contentDescription)Sets the description of the source.
enforceNotSealed();
mContentDescription = contentDescription;
|
public void | setCurrentItemIndex(int currentItemIndex)Sets the index of the source in the list of items that can be visited.
enforceNotSealed();
mCurrentItemIndex = currentItemIndex;
|
public void | setEnabled(boolean isEnabled)Sets if the source is enabled.
enforceNotSealed();
setBooleanProperty(PROPERTY_ENABLED, isEnabled);
|
public void | setFromIndex(int fromIndex)Sets the index of the first character of the changed sequence
or the beginning of a text selection or the index of the first
visible item when scrolling.
enforceNotSealed();
mFromIndex = fromIndex;
|
public void | setFullScreen(boolean isFullScreen)Sets if the source is taking the entire screen.
enforceNotSealed();
setBooleanProperty(PROPERTY_FULL_SCREEN, isFullScreen);
|
public void | setItemCount(int itemCount)Sets the number of items that can be visited.
enforceNotSealed();
mItemCount = itemCount;
|
public void | setMaxScrollX(int maxScrollX)Sets the max scroll offset of the source left edge in pixels.
enforceNotSealed();
mMaxScrollX = maxScrollX;
|
public void | setMaxScrollY(int maxScrollY)Sets the max scroll offset of the source top edge in pixels.
enforceNotSealed();
mMaxScrollY = maxScrollY;
|
public void | setParcelableData(android.os.Parcelable parcelableData)Sets the {@link Parcelable} data of the event.
enforceNotSealed();
mParcelableData = parcelableData;
|
public void | setPassword(boolean isPassword)Sets if the source is a password field.
enforceNotSealed();
setBooleanProperty(PROPERTY_PASSWORD, isPassword);
|
public void | setRemovedCount(int removedCount)Sets the number of removed characters.
enforceNotSealed();
mRemovedCount = removedCount;
|
public void | setScrollX(int scrollX)Sets the scroll offset of the source left edge in pixels.
enforceNotSealed();
mScrollX = scrollX;
|
public void | setScrollY(int scrollY)Sets the scroll offset of the source top edge in pixels.
enforceNotSealed();
mScrollY = scrollY;
|
public void | setScrollable(boolean scrollable)Sets if the source is scrollable.
enforceNotSealed();
setBooleanProperty(PROPERTY_SCROLLABLE, scrollable);
|
public void | setSealed(boolean sealed)Sets if this instance is sealed.
mSealed = sealed;
|
public void | setSource(android.view.View source)Sets the event source.
setSource(source, UNDEFINED);
|
public void | setSource(android.view.View root, int virtualDescendantId)Sets the source to be a virtual descendant of the given root .
If virtualDescendantId equals to {@link View#NO_ID} the root
is set as the source.
A virtual descendant is an imaginary View that is reported as a part of the view
hierarchy for accessibility purposes. This enables custom views that draw complex
content to report them selves as a tree of virtual views, thus conveying their
logical structure.
enforceNotSealed();
final boolean important;
if (virtualDescendantId == UNDEFINED) {
important = (root != null) ? root.isImportantForAccessibility() : true;
} else {
important = true;
}
setBooleanProperty(PROPERTY_IMPORTANT_FOR_ACCESSIBILITY, important);
mSourceWindowId = (root != null) ? root.getAccessibilityWindowId() : UNDEFINED;
final int rootViewId = (root != null) ? root.getAccessibilityViewId() : UNDEFINED;
mSourceNodeId = AccessibilityNodeInfo.makeNodeId(rootViewId, virtualDescendantId);
|
public void | setToIndex(int toIndex)Sets the index of text selection end or the index of the last
visible item when scrolling.
enforceNotSealed();
mToIndex = toIndex;
|
public void | setWindowId(int windowId)Sets the window id.
mSourceWindowId = windowId;
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder();
builder.append(" [ ClassName: " + mClassName);
builder.append("; Text: " + mText);
builder.append("; ContentDescription: " + mContentDescription);
builder.append("; ItemCount: " + mItemCount);
builder.append("; CurrentItemIndex: " + mCurrentItemIndex);
builder.append("; IsEnabled: " + getBooleanProperty(PROPERTY_ENABLED));
builder.append("; IsPassword: " + getBooleanProperty(PROPERTY_PASSWORD));
builder.append("; IsChecked: " + getBooleanProperty(PROPERTY_CHECKED));
builder.append("; IsFullScreen: " + getBooleanProperty(PROPERTY_FULL_SCREEN));
builder.append("; Scrollable: " + getBooleanProperty(PROPERTY_SCROLLABLE));
builder.append("; BeforeText: " + mBeforeText);
builder.append("; FromIndex: " + mFromIndex);
builder.append("; ToIndex: " + mToIndex);
builder.append("; ScrollX: " + mScrollX);
builder.append("; ScrollY: " + mScrollY);
builder.append("; MaxScrollX: " + mMaxScrollX);
builder.append("; MaxScrollY: " + mMaxScrollY);
builder.append("; AddedCount: " + mAddedCount);
builder.append("; RemovedCount: " + mRemovedCount);
builder.append("; ParcelableData: " + mParcelableData);
builder.append(" ]");
return builder.toString();
|