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

Commit 7bcdd702 authored by Qasid Ahmad Sadiq's avatar Qasid Ahmad Sadiq Committed by Qasid Sadiq
Browse files

Revert "Depecrate flags, and try to match them to actions"

This reverts commit 063eefa7.
The problem with this fix is that services expect to be able to
determine if a node has certain capabilities, even if it is disabled,
and doesn't have the action associated with them.

Change-Id: Ia17ed6ed5f92737226cfe704dc71957f2ae5541b
Fix: 120247282
Test: it builds.
parent b1e562de
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -52347,18 +52347,18 @@ package android.view.accessibility {
    method public void setCheckable(boolean);
    method public void setChecked(boolean);
    method public void setClassName(CharSequence);
    method @Deprecated public void setClickable(boolean);
    method public void setClickable(boolean);
    method public void setCollectionInfo(android.view.accessibility.AccessibilityNodeInfo.CollectionInfo);
    method public void setCollectionItemInfo(android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo);
    method public void setContentDescription(CharSequence);
    method public void setContentInvalid(boolean);
    method @Deprecated public void setContextClickable(boolean);
    method @Deprecated public void setDismissable(boolean);
    method public void setContextClickable(boolean);
    method public void setDismissable(boolean);
    method public void setDrawingOrder(int);
    method public void setEditable(boolean);
    method public void setEnabled(boolean);
    method public void setError(CharSequence);
    method @Deprecated public void setFocusable(boolean);
    method public void setFocusable(boolean);
    method public void setFocused(boolean);
    method public void setHeading(boolean);
    method public void setHintText(CharSequence);
@@ -52369,7 +52369,7 @@ package android.view.accessibility {
    method public void setLabeledBy(android.view.View);
    method public void setLabeledBy(android.view.View, int);
    method public void setLiveRegion(int);
    method @Deprecated public void setLongClickable(boolean);
    method public void setLongClickable(boolean);
    method public void setMaxTextLength(int);
    method public void setMovementGranularities(int);
    method public void setMultiLine(boolean);
@@ -52380,7 +52380,7 @@ package android.view.accessibility {
    method public void setPassword(boolean);
    method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo);
    method public void setScreenReaderFocusable(boolean);
    method @Deprecated public void setScrollable(boolean);
    method public void setScrollable(boolean);
    method public void setSelected(boolean);
    method public void setShowingHintText(boolean);
    method public void setSource(android.view.View);
+4 −0
Original line number Diff line number Diff line
@@ -9891,10 +9891,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        info.setContentDescription(getContentDescription());
        info.setEnabled(isEnabled());
        info.setClickable(isClickable());
        info.setFocusable(isFocusable());
        info.setScreenReaderFocusable(isScreenReaderFocusable());
        info.setFocused(isFocused());
        info.setAccessibilityFocused(isAccessibilityFocused());
        info.setSelected(isSelected());
        info.setLongClickable(isLongClickable());
        info.setContextClickable(isContextClickable());
        info.setLiveRegion(getAccessibilityLiveRegion());
        if ((mTooltipInfo != null) && (mTooltipInfo.mTooltipText != null)) {
            info.setTooltipText(mTooltipInfo.mTooltipText);
+32 −45
Original line number Diff line number Diff line
@@ -611,14 +611,22 @@ public class AccessibilityNodeInfo implements Parcelable {

    private static final int BOOLEAN_PROPERTY_CHECKED = 0x00000002;

    private static final int BOOLEAN_PROPERTY_FOCUSABLE = 0x00000004;

    private static final int BOOLEAN_PROPERTY_FOCUSED = 0x00000008;

    private static final int BOOLEAN_PROPERTY_SELECTED = 0x00000010;

    private static final int BOOLEAN_PROPERTY_CLICKABLE = 0x00000020;

    private static final int BOOLEAN_PROPERTY_LONG_CLICKABLE = 0x00000040;

    private static final int BOOLEAN_PROPERTY_ENABLED = 0x00000080;

    private static final int BOOLEAN_PROPERTY_PASSWORD = 0x00000100;

    private static final int BOOLEAN_PROPERTY_SCROLLABLE = 0x00000200;

    private static final int BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED = 0x00000400;

    private static final int BOOLEAN_PROPERTY_VISIBLE_TO_USER = 0x00000800;
@@ -633,6 +641,8 @@ public class AccessibilityNodeInfo implements Parcelable {

    private static final int BOOLEAN_PROPERTY_CONTENT_INVALID = 0x00010000;

    private static final int BOOLEAN_PROPERTY_CONTEXT_CLICKABLE = 0x00020000;

    private static final int BOOLEAN_PROPERTY_IMPORTANCE = 0x0040000;

    private static final int BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE = 0x0080000;
@@ -1191,16 +1201,6 @@ public class AccessibilityNodeInfo implements Parcelable {
        mActions.add(action);
    }

    private boolean hasActionWithId(int actionId) {
        List<AccessibilityAction> actions = getActionList();
        for (int i = 0; i < actions.size(); i++) {
            if (actions.get(i).getId() == actionId) {
                return true;
            }
        }
        return false;
    }

    /**
     * Adds an action that can be performed on the node.
     * <p>
@@ -1814,7 +1814,7 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @return True if the node is focusable.
     */
    public boolean isFocusable() {
        return hasActionWithId(ACTION_FOCUS) || hasActionWithId(ACTION_CLEAR_FOCUS);
        return getBooleanProperty(BOOLEAN_PROPERTY_FOCUSABLE);
    }

    /**
@@ -1828,11 +1828,10 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @param focusable True if the node is focusable.
     *
     * @throws IllegalStateException If called from an AccessibilityService.
     * @deprecated Use {@link #addAction(AccessibilityAction)}
     * with {@link AccessibilityAction#ACTION_FOCUS}
     */
    @Deprecated
    public void setFocusable(boolean focusable) { }
    public void setFocusable(boolean focusable) {
        setBooleanProperty(BOOLEAN_PROPERTY_FOCUSABLE, focusable);
    }

    /**
     * Gets whether this node is focused.
@@ -1940,7 +1939,7 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @return True if the node is clickable.
     */
    public boolean isClickable() {
        return hasActionWithId(ACTION_CLICK);
        return getBooleanProperty(BOOLEAN_PROPERTY_CLICKABLE);
    }

    /**
@@ -1954,11 +1953,10 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @param clickable True if the node is clickable.
     *
     * @throws IllegalStateException If called from an AccessibilityService.
     * @deprecated Use {@link #addAction(AccessibilityAction)}
     * with {@link AccessibilityAction#ACTION_CLICK}
     */
    @Deprecated
    public void setClickable(boolean clickable) { }
    public void setClickable(boolean clickable) {
        setBooleanProperty(BOOLEAN_PROPERTY_CLICKABLE, clickable);
    }

    /**
     * Gets whether this node is long clickable.
@@ -1966,7 +1964,7 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @return True if the node is long clickable.
     */
    public boolean isLongClickable() {
        return hasActionWithId(ACTION_LONG_CLICK);
        return getBooleanProperty(BOOLEAN_PROPERTY_LONG_CLICKABLE);
    }

    /**
@@ -1980,11 +1978,10 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @param longClickable True if the node is long clickable.
     *
     * @throws IllegalStateException If called from an AccessibilityService.
     * @deprecated Use {@link #addAction(AccessibilityAction)}
     * with {@link AccessibilityAction#ACTION_LONG_CLICK}
     */
    @Deprecated
    public void setLongClickable(boolean longClickable) { }
    public void setLongClickable(boolean longClickable) {
        setBooleanProperty(BOOLEAN_PROPERTY_LONG_CLICKABLE, longClickable);
    }

    /**
     * Gets whether this node is enabled.
@@ -2042,13 +2039,7 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @return True if the node is scrollable, false otherwise.
     */
    public boolean isScrollable() {
        return hasActionWithId(ACTION_SCROLL_BACKWARD)
                || hasActionWithId(ACTION_SCROLL_FORWARD)
                || hasActionWithId(R.id.accessibilityActionScrollToPosition)
                || hasActionWithId(R.id.accessibilityActionScrollUp)
                || hasActionWithId(R.id.accessibilityActionScrollDown)
                || hasActionWithId(R.id.accessibilityActionScrollLeft)
                || hasActionWithId(R.id.accessibilityActionScrollRight);
        return getBooleanProperty(BOOLEAN_PROPERTY_SCROLLABLE);
    }

    /**
@@ -2062,11 +2053,9 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @param scrollable True if the node is scrollable, false otherwise.
     *
     * @throws IllegalStateException If called from an AccessibilityService.
     * @deprecated Use {@link #addAction(AccessibilityAction)}
     */
    @Deprecated

    public void setScrollable(boolean scrollable) {
        setBooleanProperty(BOOLEAN_PROPERTY_SCROLLABLE, scrollable);
    }

    /**
@@ -2257,7 +2246,7 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @return True if the node is context clickable.
     */
    public boolean isContextClickable() {
        return hasActionWithId(R.id.accessibilityActionContextClick);
        return getBooleanProperty(BOOLEAN_PROPERTY_CONTEXT_CLICKABLE);
    }

    /**
@@ -2270,11 +2259,10 @@ public class AccessibilityNodeInfo implements Parcelable {
     *
     * @param contextClickable True if the node is context clickable.
     * @throws IllegalStateException If called from an AccessibilityService.
     * @deprecated Use {@link #addAction(AccessibilityAction)}
     * with {@link AccessibilityAction#ACTION_CONTEXT_CLICK}
     */
    @Deprecated
    public void setContextClickable(boolean contextClickable) { }
    public void setContextClickable(boolean contextClickable) {
        setBooleanProperty(BOOLEAN_PROPERTY_CONTEXT_CLICKABLE, contextClickable);
    }

    /**
     * Gets the node's live region mode.
@@ -2368,7 +2356,7 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @return If the node can be dismissed.
     */
    public boolean isDismissable() {
        return hasActionWithId(ACTION_DISMISS);
        return getBooleanProperty(BOOLEAN_PROPERTY_DISMISSABLE);
    }

    /**
@@ -2380,11 +2368,10 @@ public class AccessibilityNodeInfo implements Parcelable {
     * </p>
     *
     * @param dismissable If the node can be dismissed.
     * @deprecated Use {@link #addAction(AccessibilityAction)}
     * with {@link AccessibilityAction#ACTION_DISMISS}
     */
    @Deprecated
    public void setDismissable(boolean dismissable) { }
    public void setDismissable(boolean dismissable) {
        setBooleanProperty(BOOLEAN_PROPERTY_DISMISSABLE, dismissable);
    }

    /**
     * Returns whether the node originates from a view considered important for accessibility.
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,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 = 18;
    private static final int NUM_BOOLEAN_PROPERTIES = 23;

    @Test
    public void testStandardActions_serializationFlagIsValid() {