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

Commit a42495ef authored by Rhed Jao's avatar Rhed Jao
Browse files

Add text entry key property to a11y info node

This property is used to help accessibility services to
improve the typing experience

Bug: 110990026
Test: atest AccessibilityNodeInfoTest
Change-Id: I5295ac8b321e1539df7c83ee7b8b376df5ef8721
parent 6910e140
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -49634,6 +49634,7 @@ package android.view.accessibility {
    method public boolean isScrollable();
    method public boolean isScrollable();
    method public boolean isSelected();
    method public boolean isSelected();
    method public boolean isShowingHintText();
    method public boolean isShowingHintText();
    method public boolean isTextEntryKey();
    method public boolean isVisibleToUser();
    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);
    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int);
    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int);
@@ -49695,6 +49696,7 @@ package android.view.accessibility {
    method public void setSource(android.view.View);
    method public void setSource(android.view.View);
    method public void setSource(android.view.View, int);
    method public void setSource(android.view.View, int);
    method public void setText(java.lang.CharSequence);
    method public void setText(java.lang.CharSequence);
    method public void setTextEntryKey(boolean);
    method public void setTextSelection(int, int);
    method public void setTextSelection(int, int);
    method public void setTooltipText(java.lang.CharSequence);
    method public void setTooltipText(java.lang.CharSequence);
    method public void setTraversalAfter(android.view.View);
    method public void setTraversalAfter(android.view.View);
+26 −0
Original line number Original line 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_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.
     * 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);
        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.
     * Gets the package this node comes from.
     *
     *
+1 −1
Original line number Original line 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
    // The number of flags held in boolean properties. Their values should also be double-checked
    // in the methods above.
    // in the methods above.
    private static final int NUM_BOOLEAN_PROPERTIES = 17;
    private static final int NUM_BOOLEAN_PROPERTIES = 18;


    @Test
    @Test
    public void testStandardActions_serializationFlagIsValid() {
    public void testStandardActions_serializationFlagIsValid() {