Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0a8cd10 authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Text in accessibility events not consistent

bug:2513822

Text added to accessibility events is truncated to max
length. However, the fromIndex and toIndex properties
are relative to the text before being truncated, thus
potentially our of bound. Removed the max length
limitation because test very rarely is longer that
500 characters and in the cases in which text is longer
than 500 character it will not be a real problem to
pass a bit more data through an IPC (very rarely).

Change-Id: Ie70ac630dfeb56d4f59079abb2f46d07582796b6
parent 46c9975e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -159,7 +159,12 @@ public final class AccessibilityEvent implements Parcelable {
     *
     * @see #getBeforeText()
     * @see #getText()
     * </br>
     * Note: This constant is no longer needed since there
     *       is no limit on the length of text that is contained
     *       in an accessibility event anymore.
     */
    @Deprecated
    public static final int MAX_TEXT_LENGTH = 500;

    /**
+0 −3
Original line number Diff line number Diff line
@@ -7898,9 +7898,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                text = getHint();
            }
            if (!TextUtils.isEmpty(text)) {
                if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) {
                    text = text.subSequence(0, AccessibilityEvent.MAX_TEXT_LENGTH + 1);
                }
                event.getText().add(text);
            }
        } else {