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

Commit 7102a0df authored by Rhed Jao's avatar Rhed Jao Committed by Android (Google) Code Review
Browse files

Merge "Add text entry key property to a11y info node"

parents b9a88157 a42495ef
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -49753,6 +49753,7 @@ package android.view.accessibility {
    method public boolean isScrollable();
    method public boolean isSelected();
    method public boolean isShowingHintText();
    method public boolean isTextEntryKey();
    method public boolean isVisibleToUser();
    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View);
    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int);
@@ -49814,6 +49815,7 @@ package android.view.accessibility {
    method public void setSource(android.view.View);
    method public void setSource(android.view.View, int);
    method public void setText(java.lang.CharSequence);
    method public void setTextEntryKey(boolean);
    method public void setTextSelection(int, int);
    method public void setTooltipText(java.lang.CharSequence);
    method public void setTraversalAfter(android.view.View);
+26 −0
Original line number Diff line number Diff line
@@ -632,6 +632,8 @@ public class AccessibilityNodeInfo implements Parcelable {

    private static final int BOOLEAN_PROPERTY_IS_HEADING = 0x0200000;

    private static final int BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY = 0x0400000;

    /**
     * Bits that provide the id of a virtual descendant of a view.
     */
@@ -2460,6 +2462,30 @@ public class AccessibilityNodeInfo implements Parcelable {
        setBooleanProperty(BOOLEAN_PROPERTY_IS_HEADING, isHeading);
    }

    /**
     * Returns whether node represents a text entry key that is part of a keyboard or keypad.
     *
     * @return {@code true} if the node is a text entry key., {@code false} otherwise.
     */
    public boolean isTextEntryKey() {
        return getBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY);
    }

    /**
     * Sets whether the node represents a text entry key that is part of a keyboard or keypad.
     *
     * <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 isTextEntryKey {@code true} if the node is a text entry key, {@code false} otherwise.
     */
    public void setTextEntryKey(boolean isTextEntryKey) {
        setBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY, isTextEntryKey);
    }

    /**
     * Gets the package this node comes from.
     *
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public class AccessibilityNodeInfoTest {

    // The number of flags held in boolean properties. Their values should also be double-checked
    // in the methods above.
    private static final int NUM_BOOLEAN_PROPERTIES = 17;
    private static final int NUM_BOOLEAN_PROPERTIES = 18;

    @Test
    public void testStandardActions_serializationFlagIsValid() {