summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt5
-rw-r--r--core/java/android/view/accessibility/AccessibilityNodeInfo.java173
-rw-r--r--core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java2
3 files changed, 1 insertions, 179 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 69c409bb5261..d610f4c8d4ed 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -54862,8 +54862,6 @@ package android.view.accessibility {
method @Deprecated public void addAction(int);
method public void addChild(android.view.View);
method public void addChild(android.view.View, int);
- method @FlaggedApi("android.view.accessibility.support_multiple_labeledby") public void addLabeledBy(@NonNull android.view.View);
- method @FlaggedApi("android.view.accessibility.support_multiple_labeledby") public void addLabeledBy(@NonNull android.view.View, int);
method public boolean canOpenPopup();
method public int describeContents();
method public java.util.List<android.view.accessibility.AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String);
@@ -54892,7 +54890,6 @@ package android.view.accessibility {
method public int getInputType();
method public android.view.accessibility.AccessibilityNodeInfo getLabelFor();
method public android.view.accessibility.AccessibilityNodeInfo getLabeledBy();
- method @FlaggedApi("android.view.accessibility.support_multiple_labeledby") @NonNull public java.util.List<android.view.accessibility.AccessibilityNodeInfo> getLabeledByList();
method public int getLiveRegion();
method public int getMaxTextLength();
method @NonNull public java.time.Duration getMinDurationBetweenContentChanges();
@@ -54953,8 +54950,6 @@ package android.view.accessibility {
method public boolean removeAction(android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction);
method public boolean removeChild(android.view.View);
method public boolean removeChild(android.view.View, int);
- method @FlaggedApi("android.view.accessibility.support_multiple_labeledby") public boolean removeLabeledBy(@NonNull android.view.View);
- method @FlaggedApi("android.view.accessibility.support_multiple_labeledby") public boolean removeLabeledBy(@NonNull android.view.View, int);
method public void setAccessibilityDataSensitive(boolean);
method public void setAccessibilityFocused(boolean);
method public void setAvailableExtraData(java.util.List<java.lang.String>);
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 90cfcb1e64a8..a5ba294d6a19 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -982,7 +982,6 @@ public class AccessibilityNodeInfo implements Parcelable {
private long mParentNodeId = UNDEFINED_NODE_ID;
private long mLabelForId = UNDEFINED_NODE_ID;
private long mLabeledById = UNDEFINED_NODE_ID;
- private LongArray mLabeledByIds;
private long mTraversalBefore = UNDEFINED_NODE_ID;
private long mTraversalAfter = UNDEFINED_NODE_ID;
@@ -3600,131 +3599,6 @@ public class AccessibilityNodeInfo implements Parcelable {
}
/**
- * Adds the view which serves as the label of the view represented by
- * this info for accessibility purposes. When more than one labels are
- * added, the content from each label is combined in the order that
- * they are added.
- * <p>
- * If visible text can be used to describe or give meaning to this UI,
- * this method is preferred. For example, a TextView before an EditText
- * in the UI usually specifies what information is contained in the
- * EditText. Hence, the EditText is labelled by the TextView.
- * </p>
- *
- * @param label A view that labels this node's source.
- */
- @FlaggedApi(Flags.FLAG_SUPPORT_MULTIPLE_LABELEDBY)
- public void addLabeledBy(@NonNull View label) {
- addLabeledBy(label, AccessibilityNodeProvider.HOST_VIEW_ID);
- }
-
- /**
- * Adds the view which serves as the label of the view represented by
- * this info for accessibility purposes. If <code>virtualDescendantId</code>
- * is {@link View#NO_ID} the root is set as the label. When more than one
- * labels are added, the content from each label is combined in the order
- * that they are added.
- * <p>
- * 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 themselves as a tree of virtual views, thus conveying their
- * logical structure.
- * </p>
- * <p>
- * If visible text can be used to describe or give meaning to this UI,
- * this method is preferred. For example, a TextView before an EditText
- * in the UI usually specifies what information is contained in the
- * EditText. Hence, the EditText is labelled by the TextView.
- * </p>
- * <p>
- * <strong>Note:</strong> Cannot be called from an
- * {@link android.accessibilityservice.AccessibilityService}.
- * This class is made immutable before being delivered to an AccessibilityService.
- * </p>
- *
- * @param root A root whose virtual descendant labels this node's source.
- * @param virtualDescendantId The id of the virtual descendant.
- */
- @FlaggedApi(Flags.FLAG_SUPPORT_MULTIPLE_LABELEDBY)
- public void addLabeledBy(@NonNull View root, int virtualDescendantId) {
- enforceNotSealed();
- Preconditions.checkNotNull(root, "%s must not be null", root);
- if (mLabeledByIds == null) {
- mLabeledByIds = new LongArray();
- }
- mLabeledById = makeNodeId(root.getAccessibilityViewId(), virtualDescendantId);
- mLabeledByIds.add(mLabeledById);
- }
-
- /**
- * Gets the list of node infos which serve as the labels of the view represented by
- * this info for accessibility purposes.
- *
- * @return The list of labels in the order that they were added.
- */
- @FlaggedApi(Flags.FLAG_SUPPORT_MULTIPLE_LABELEDBY)
- public @NonNull List<AccessibilityNodeInfo> getLabeledByList() {
- enforceSealed();
- List<AccessibilityNodeInfo> labels = new ArrayList<>();
- if (mLabeledByIds == null) {
- return labels;
- }
- for (int i = 0; i < mLabeledByIds.size(); i++) {
- labels.add(getNodeForAccessibilityId(mConnectionId, mWindowId, mLabeledByIds.get(i)));
- }
- return labels;
- }
-
- /**
- * Removes a label. If the label was not previously added to the node,
- * calling this method has no effect.
- * <p>
- * <strong>Note:</strong> Cannot be called from an
- * {@link android.accessibilityservice.AccessibilityService}.
- * This class is made immutable before being delivered to an AccessibilityService.
- * </p>
- *
- * @param label The node which serves as this node's label.
- * @return true if the label was present
- * @see #addLabeledBy(View)
- */
- @FlaggedApi(Flags.FLAG_SUPPORT_MULTIPLE_LABELEDBY)
- public boolean removeLabeledBy(@NonNull View label) {
- return removeLabeledBy(label, AccessibilityNodeProvider.HOST_VIEW_ID);
- }
-
- /**
- * Removes a virtual label which is a descendant of the given
- * <code>root</code>. If the label was not previously added to the node,
- * calling this method has no effect.
- *
- * @param root The root of the virtual subtree.
- * @param virtualDescendantId The id of the virtual node which serves as this node's label.
- * @return true if the label was present
- * @see #addLabeledBy(View, int)
- */
- @FlaggedApi(Flags.FLAG_SUPPORT_MULTIPLE_LABELEDBY)
- public boolean removeLabeledBy(@NonNull View root, int virtualDescendantId) {
- enforceNotSealed();
- final LongArray labeledByIds = mLabeledByIds;
- if (labeledByIds == null) {
- return false;
- }
- final int rootAccessibilityViewId =
- (root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
- final long labeledById = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
- if (mLabeledById == labeledById) {
- mLabeledById = UNDEFINED_NODE_ID;
- }
- final int index = labeledByIds.indexOf(labeledById);
- if (index < 0) {
- return false;
- }
- labeledByIds.remove(index);
- return true;
- }
-
- /**
* Sets the view which serves as the label of the view represented by
* this info for accessibility purposes.
*
@@ -3757,17 +3631,7 @@ public class AccessibilityNodeInfo implements Parcelable {
enforceNotSealed();
final int rootAccessibilityViewId = (root != null)
? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
- if (Flags.supportMultipleLabeledby()) {
- if (mLabeledByIds == null) {
- mLabeledByIds = new LongArray();
- } else {
- mLabeledByIds.clear();
- }
- }
mLabeledById = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
- if (Flags.supportMultipleLabeledby()) {
- mLabeledByIds.add(mLabeledById);
- }
}
/**
@@ -4378,12 +4242,6 @@ public class AccessibilityNodeInfo implements Parcelable {
fieldIndex++;
if (mLabeledById != DEFAULT.mLabeledById) nonDefaultFields |= bitAt(fieldIndex);
fieldIndex++;
- if (Flags.supportMultipleLabeledby()) {
- if (!LongArray.elementsEqual(mLabeledByIds, DEFAULT.mLabeledByIds)) {
- nonDefaultFields |= bitAt(fieldIndex);
- }
- fieldIndex++;
- }
if (mTraversalBefore != DEFAULT.mTraversalBefore) nonDefaultFields |= bitAt(fieldIndex);
fieldIndex++;
if (mTraversalAfter != DEFAULT.mTraversalAfter) nonDefaultFields |= bitAt(fieldIndex);
@@ -4525,20 +4383,6 @@ public class AccessibilityNodeInfo implements Parcelable {
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mParentNodeId);
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mLabelForId);
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mLabeledById);
- if (Flags.supportMultipleLabeledby()) {
- if (isBitSet(nonDefaultFields, fieldIndex++)) {
- final LongArray labeledByIds = mLabeledByIds;
- if (labeledByIds == null) {
- parcel.writeInt(0);
- } else {
- final int labeledByIdsSize = labeledByIds.size();
- parcel.writeInt(labeledByIdsSize);
- for (int i = 0; i < labeledByIdsSize; i++) {
- parcel.writeLong(labeledByIds.get(i));
- }
- }
- }
- }
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mTraversalBefore);
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mTraversalAfter);
if (isBitSet(nonDefaultFields, fieldIndex++)) {
@@ -4706,9 +4550,6 @@ public class AccessibilityNodeInfo implements Parcelable {
mParentNodeId = other.mParentNodeId;
mLabelForId = other.mLabelForId;
mLabeledById = other.mLabeledById;
- if (Flags.supportMultipleLabeledby()) {
- mLabeledByIds = other.mLabeledByIds;
- }
mTraversalBefore = other.mTraversalBefore;
mTraversalAfter = other.mTraversalAfter;
mMinDurationBetweenContentChanges = other.mMinDurationBetweenContentChanges;
@@ -4815,20 +4656,6 @@ public class AccessibilityNodeInfo implements Parcelable {
if (isBitSet(nonDefaultFields, fieldIndex++)) mParentNodeId = parcel.readLong();
if (isBitSet(nonDefaultFields, fieldIndex++)) mLabelForId = parcel.readLong();
if (isBitSet(nonDefaultFields, fieldIndex++)) mLabeledById = parcel.readLong();
- if (Flags.supportMultipleLabeledby()) {
- if (isBitSet(nonDefaultFields, fieldIndex++)) {
- final int labeledByIdsSize = parcel.readInt();
- if (labeledByIdsSize <= 0) {
- mLabeledByIds = null;
- } else {
- mLabeledByIds = new LongArray(labeledByIdsSize);
- for (int i = 0; i < labeledByIdsSize; i++) {
- final long labeledById = parcel.readLong();
- mLabeledByIds.add(labeledById);
- }
- }
- }
- }
if (isBitSet(nonDefaultFields, fieldIndex++)) mTraversalBefore = parcel.readLong();
if (isBitSet(nonDefaultFields, fieldIndex++)) mTraversalAfter = parcel.readLong();
if (isBitSet(nonDefaultFields, fieldIndex++)) {
diff --git a/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java b/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
index 2d82d231e279..3d4918b1bd42 100644
--- a/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
+++ b/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
@@ -46,7 +46,7 @@ public class AccessibilityNodeInfoTest {
// The number of fields tested in the corresponding CTS AccessibilityNodeInfoTest:
// See fullyPopulateAccessibilityNodeInfo, assertEqualsAccessibilityNodeInfo,
// and assertAccessibilityNodeInfoCleared in that class.
- private static final int NUM_MARSHALLED_PROPERTIES = 44;
+ private static final int NUM_MARSHALLED_PROPERTIES = 43;
/**
* The number of properties that are purposely not marshalled