diff --git a/api/current.txt b/api/current.txt index 11a5f770172c9..ce92fcb173a39 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28434,6 +28434,7 @@ package android.view { method public void invalidate(int, int, int, int); method public void invalidate(); method public void invalidateDrawable(android.graphics.drawable.Drawable); + method public boolean isAccessibilityFocused(); method public boolean isActivated(); method public boolean isAttachedToWindow(); method public boolean isClickable(); @@ -28449,6 +28450,7 @@ package android.view { method public boolean isHorizontalFadingEdgeEnabled(); method public boolean isHorizontalScrollBarEnabled(); method public boolean isHovered(); + method public boolean isImportantForAccessibility(); method public boolean isInEditMode(); method public boolean isInLayout(); method public boolean isInTouchMode(); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5d264b6bae298..7e5cb1e9e0b0b 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6941,7 +6941,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Returns whether this View is accessibility focused. * * @return True if this View is accessibility focused. - * @hide */ public boolean isAccessibilityFocused() { return (mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) != 0; @@ -7289,11 +7288,38 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Gets whether this view should be exposed for accessibility. + * Computes whether this view should be exposed for accessibility. In + * general, views that are interactive or provide information are exposed + * while views that serve only as containers are hidden. + *

+ * If an ancestor of this view has importance + * {@link #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS}, this method + * returns false. + *

+ * Otherwise, the value is computed according to the view's + * {@link #getImportantForAccessibility()} value: + *

    + *
  1. {@link #IMPORTANT_FOR_ACCESSIBILITY_NO} or + * {@link #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS}, return false + * + *
  2. {@link #IMPORTANT_FOR_ACCESSIBILITY_YES}, return true + *
  3. {@link #IMPORTANT_FOR_ACCESSIBILITY_AUTO}, return true if + * view satisfies any of the following: + * + *
* * @return Whether the view is exposed for accessibility. - * - * @hide + * @see #setImportantForAccessibility(int) + * @see #getImportantForAccessibility() */ public boolean isImportantForAccessibility() { final int mode = (mPrivateFlags2 & PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK)