Loading api/current.txt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1119,6 +1119,7 @@ package android { field public static final int scheme = 16842791; // 0x1010027 field public static final int scheme = 16842791; // 0x1010027 field public static final int screenDensity = 16843467; // 0x10102cb field public static final int screenDensity = 16843467; // 0x10102cb field public static final int screenOrientation = 16842782; // 0x101001e field public static final int screenOrientation = 16842782; // 0x101001e field public static final int screenReaderFocusable = 16844148; // 0x1010574 field public static final int screenSize = 16843466; // 0x10102ca field public static final int screenSize = 16843466; // 0x10102ca field public static final int scrollHorizontally = 16843099; // 0x101015b field public static final int scrollHorizontally = 16843099; // 0x101015b field public static final int scrollIndicators = 16844006; // 0x10104e6 field public static final int scrollIndicators = 16844006; // 0x10104e6 Loading Loading @@ -46331,6 +46332,7 @@ package android.view { method public boolean isPressed(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); method public boolean isSaveFromParentEnabled(); method public boolean isScreenReaderFocusable(); method public boolean isScrollContainer(); method public boolean isScrollContainer(); method public boolean isScrollbarFadingEnabled(); method public boolean isScrollbarFadingEnabled(); method public boolean isSelected(); method public boolean isSelected(); Loading Loading @@ -46550,6 +46552,7 @@ package android.view { method public void setSaveFromParentEnabled(boolean); method public void setSaveFromParentEnabled(boolean); method public void setScaleX(float); method public void setScaleX(float); method public void setScaleY(float); method public void setScaleY(float); method public void setScreenReaderFocusable(boolean); method public void setScrollBarDefaultDelayBeforeFade(int); method public void setScrollBarDefaultDelayBeforeFade(int); method public void setScrollBarFadeDuration(int); method public void setScrollBarFadeDuration(int); method public void setScrollBarSize(int); method public void setScrollBarSize(int); Loading Loading @@ -47968,6 +47971,7 @@ package android.view.accessibility { method public boolean isLongClickable(); method public boolean isLongClickable(); method public boolean isMultiLine(); method public boolean isMultiLine(); method public boolean isPassword(); method public boolean isPassword(); method public boolean isScreenReaderFocusable(); method public boolean isScrollable(); method public boolean isScrollable(); method public boolean isSelected(); method public boolean isSelected(); method public boolean isShowingHintText(); method public boolean isShowingHintText(); Loading Loading @@ -48023,6 +48027,7 @@ package android.view.accessibility { method public void setParent(android.view.View, int); method public void setParent(android.view.View, int); method public void setPassword(boolean); method public void setPassword(boolean); method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo); method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo); method public void setScreenReaderFocusable(boolean); method public void setScrollable(boolean); method public void setScrollable(boolean); method public void setSelected(boolean); method public void setSelected(boolean); method public void setShowingHintText(boolean); method public void setShowingHintText(boolean); core/java/android/view/View.java +52 −0 Original line number Original line Diff line number Diff line Loading @@ -2929,6 +2929,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 1 PFLAG3_TEMPORARY_DETACH * 1 PFLAG3_TEMPORARY_DETACH * 1 PFLAG3_NO_REVEAL_ON_FOCUS * 1 PFLAG3_NO_REVEAL_ON_FOCUS * 1 PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT * 1 PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT * 1 PFLAG3_SCREEN_READER_FOCUSABLE * |-------|-------|-------|-------| * |-------|-------|-------|-------| */ */ Loading Loading @@ -3209,6 +3210,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ */ static final int PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT = 0x8000000; static final int PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT = 0x8000000; /** * Works like focusable for screen readers, but without the side effects on input focus. * @see #setScreenReaderFocusable(boolean) */ private static final int PFLAG3_SCREEN_READER_FOCUSABLE = 0x10000000; /* End of masks for mPrivateFlags3 */ /* End of masks for mPrivateFlags3 */ /** /** Loading Loading @@ -5344,6 +5351,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setDefaultFocusHighlightEnabled(a.getBoolean(attr, true)); setDefaultFocusHighlightEnabled(a.getBoolean(attr, true)); } } break; break; case R.styleable.View_screenReaderFocusable: if (a.peekValue(attr) != null) { setScreenReaderFocusable(a.getBoolean(attr, false)); } break; } } } } Loading Loading @@ -8394,6 +8406,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, info.setEnabled(isEnabled()); info.setEnabled(isEnabled()); info.setClickable(isClickable()); info.setClickable(isClickable()); info.setFocusable(isFocusable()); info.setFocusable(isFocusable()); info.setScreenReaderFocusable(isScreenReaderFocusable()); info.setFocused(isFocused()); info.setFocused(isFocused()); info.setAccessibilityFocused(isAccessibilityFocused()); info.setAccessibilityFocused(isAccessibilityFocused()); info.setSelected(isSelected()); info.setSelected(isSelected()); Loading Loading @@ -10349,6 +10362,45 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return FOCUSABLE_IN_TOUCH_MODE == (mViewFlags & FOCUSABLE_IN_TOUCH_MODE); return FOCUSABLE_IN_TOUCH_MODE == (mViewFlags & FOCUSABLE_IN_TOUCH_MODE); } } /** * Returns whether the view should be treated as a focusable unit by screen reader * accessibility tools. * @see #setScreenReaderFocusable(boolean) * * @return Whether the view should be treated as a focusable unit by screen reader. */ public boolean isScreenReaderFocusable() { return (mPrivateFlags3 & PFLAG3_SCREEN_READER_FOCUSABLE) != 0; } /** * When screen readers (one type of accessibility tool) decide what should be read to the * user, they typically look for input focusable ({@link #isFocusable()}) parents of * non-focusable text items, and read those focusable parents and their non-focusable children * as a unit. In some situations, this behavior is desirable for views that should not take * input focus. Setting an item to be screen reader focusable requests that the view be * treated as a unit by screen readers without any effect on input focusability. The default * value of {@code false} lets screen readers use other signals, like focusable, to determine * how to group items. * * @param screenReaderFocusable Whether the view should be treated as a unit by screen reader * accessibility tools. */ public void setScreenReaderFocusable(boolean screenReaderFocusable) { int pflags3 = mPrivateFlags3; if (screenReaderFocusable) { pflags3 |= PFLAG3_SCREEN_READER_FOCUSABLE; } else { pflags3 &= ~PFLAG3_SCREEN_READER_FOCUSABLE; } if (pflags3 != mPrivateFlags3) { mPrivateFlags3 = pflags3; notifyViewAccessibilityStateChangedIfNeeded( AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED); } } /** /** * Find the nearest view in the specified direction that can take focus. * Find the nearest view in the specified direction that can take focus. * This does not actually give focus to that view. * This does not actually give focus to that view. core/java/android/view/ViewGroup.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2591,7 +2591,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager boolean alreadyDispatchedToNewTouchTarget = false; boolean alreadyDispatchedToNewTouchTarget = false; if (!canceled && !intercepted) { if (!canceled && !intercepted) { // If the event is targeting accessiiblity focus we give it to the // If the event is targeting accessibility focus we give it to the // view that has accessibility focus and if it does not handle it // view that has accessibility focus and if it does not handle it // we clear the flag and dispatch the event to all children as usual. // we clear the flag and dispatch the event to all children as usual. // We are looking up the accessibility focused host to avoid keeping // We are looking up the accessibility focused host to avoid keeping Loading core/java/android/view/accessibility/AccessibilityNodeInfo.java +33 −0 Original line number Original line Diff line number Diff line Loading @@ -635,6 +635,8 @@ public class AccessibilityNodeInfo implements Parcelable { private static final int BOOLEAN_PROPERTY_IMPORTANCE = 0x0040000; private static final int BOOLEAN_PROPERTY_IMPORTANCE = 0x0040000; private static final int BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE = 0x0080000; private static final int BOOLEAN_PROPERTY_IS_SHOWING_HINT = 0x0100000; private static final int BOOLEAN_PROPERTY_IS_SHOWING_HINT = 0x0100000; /** /** Loading Loading @@ -2320,6 +2322,37 @@ public class AccessibilityNodeInfo implements Parcelable { setBooleanProperty(BOOLEAN_PROPERTY_IMPORTANCE, important); setBooleanProperty(BOOLEAN_PROPERTY_IMPORTANCE, important); } } /** * Returns whether the node is explicitly marked as a focusable unit by a screen reader. Note * that {@code false} indicates that it is not explicitly marked, not that the node is not * a focusable unit. Screen readers should generally used other signals, such as * {@link #isFocusable()}, or the presence of text in a node, to determine what should receive * focus. * * @return {@code true} if the node is specifically marked as a focusable unit for screen * readers, {@code false} otherwise. * * @see View#isScreenReaderFocusable() */ public boolean isScreenReaderFocusable() { return getBooleanProperty(BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE); } /** * Sets whether the node should be considered a focusable unit by a screen reader. * <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 screenReaderFocusable {@code true} if the node is a focusable unit for screen readers, * {@code false} otherwise. */ public void setScreenReaderFocusable(boolean screenReaderFocusable) { setBooleanProperty(BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE, screenReaderFocusable); } /** /** * Returns whether the node's text represents a hint for the user to enter text. It should only * Returns whether the node's text represents a hint for the user to enter text. It should only * be {@code true} if the node has editable text. * be {@code true} if the node has editable text. Loading core/res/res/values/attrs.xml +6 −0 Original line number Original line Diff line number Diff line Loading @@ -3021,6 +3021,12 @@ <!-- Whether this View should use a default focus highlight when it gets focused but <!-- Whether this View should use a default focus highlight when it gets focused but doesn't have {@link android.R.attr#state_focused} defined in its background. --> doesn't have {@link android.R.attr#state_focused} defined in its background. --> <attr name="defaultFocusHighlightEnabled" format="boolean" /> <attr name="defaultFocusHighlightEnabled" format="boolean" /> <!-- Whether this view should be treated as a focusable unit by screen reader accessibility tools. See {@link android.view.View#setScreenReaderFocusable(boolean)}. The default value, {@code false}, leaves the screen reader to consider other signals, such as focusability or the presence of text, to decide what it focus.--> <attr name="screenReaderFocusable" format="boolean" /> </declare-styleable> </declare-styleable> <!-- Attributes that can be assigned to a tag for a particular View. --> <!-- Attributes that can be assigned to a tag for a particular View. --> Loading Loading
api/current.txt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1119,6 +1119,7 @@ package android { field public static final int scheme = 16842791; // 0x1010027 field public static final int scheme = 16842791; // 0x1010027 field public static final int screenDensity = 16843467; // 0x10102cb field public static final int screenDensity = 16843467; // 0x10102cb field public static final int screenOrientation = 16842782; // 0x101001e field public static final int screenOrientation = 16842782; // 0x101001e field public static final int screenReaderFocusable = 16844148; // 0x1010574 field public static final int screenSize = 16843466; // 0x10102ca field public static final int screenSize = 16843466; // 0x10102ca field public static final int scrollHorizontally = 16843099; // 0x101015b field public static final int scrollHorizontally = 16843099; // 0x101015b field public static final int scrollIndicators = 16844006; // 0x10104e6 field public static final int scrollIndicators = 16844006; // 0x10104e6 Loading Loading @@ -46331,6 +46332,7 @@ package android.view { method public boolean isPressed(); method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); method public boolean isSaveFromParentEnabled(); method public boolean isScreenReaderFocusable(); method public boolean isScrollContainer(); method public boolean isScrollContainer(); method public boolean isScrollbarFadingEnabled(); method public boolean isScrollbarFadingEnabled(); method public boolean isSelected(); method public boolean isSelected(); Loading Loading @@ -46550,6 +46552,7 @@ package android.view { method public void setSaveFromParentEnabled(boolean); method public void setSaveFromParentEnabled(boolean); method public void setScaleX(float); method public void setScaleX(float); method public void setScaleY(float); method public void setScaleY(float); method public void setScreenReaderFocusable(boolean); method public void setScrollBarDefaultDelayBeforeFade(int); method public void setScrollBarDefaultDelayBeforeFade(int); method public void setScrollBarFadeDuration(int); method public void setScrollBarFadeDuration(int); method public void setScrollBarSize(int); method public void setScrollBarSize(int); Loading Loading @@ -47968,6 +47971,7 @@ package android.view.accessibility { method public boolean isLongClickable(); method public boolean isLongClickable(); method public boolean isMultiLine(); method public boolean isMultiLine(); method public boolean isPassword(); method public boolean isPassword(); method public boolean isScreenReaderFocusable(); method public boolean isScrollable(); method public boolean isScrollable(); method public boolean isSelected(); method public boolean isSelected(); method public boolean isShowingHintText(); method public boolean isShowingHintText(); Loading Loading @@ -48023,6 +48027,7 @@ package android.view.accessibility { method public void setParent(android.view.View, int); method public void setParent(android.view.View, int); method public void setPassword(boolean); method public void setPassword(boolean); method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo); method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo); method public void setScreenReaderFocusable(boolean); method public void setScrollable(boolean); method public void setScrollable(boolean); method public void setSelected(boolean); method public void setSelected(boolean); method public void setShowingHintText(boolean); method public void setShowingHintText(boolean);
core/java/android/view/View.java +52 −0 Original line number Original line Diff line number Diff line Loading @@ -2929,6 +2929,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 1 PFLAG3_TEMPORARY_DETACH * 1 PFLAG3_TEMPORARY_DETACH * 1 PFLAG3_NO_REVEAL_ON_FOCUS * 1 PFLAG3_NO_REVEAL_ON_FOCUS * 1 PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT * 1 PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT * 1 PFLAG3_SCREEN_READER_FOCUSABLE * |-------|-------|-------|-------| * |-------|-------|-------|-------| */ */ Loading Loading @@ -3209,6 +3210,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ */ static final int PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT = 0x8000000; static final int PFLAG3_NOTIFY_AUTOFILL_ENTER_ON_LAYOUT = 0x8000000; /** * Works like focusable for screen readers, but without the side effects on input focus. * @see #setScreenReaderFocusable(boolean) */ private static final int PFLAG3_SCREEN_READER_FOCUSABLE = 0x10000000; /* End of masks for mPrivateFlags3 */ /* End of masks for mPrivateFlags3 */ /** /** Loading Loading @@ -5344,6 +5351,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setDefaultFocusHighlightEnabled(a.getBoolean(attr, true)); setDefaultFocusHighlightEnabled(a.getBoolean(attr, true)); } } break; break; case R.styleable.View_screenReaderFocusable: if (a.peekValue(attr) != null) { setScreenReaderFocusable(a.getBoolean(attr, false)); } break; } } } } Loading Loading @@ -8394,6 +8406,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, info.setEnabled(isEnabled()); info.setEnabled(isEnabled()); info.setClickable(isClickable()); info.setClickable(isClickable()); info.setFocusable(isFocusable()); info.setFocusable(isFocusable()); info.setScreenReaderFocusable(isScreenReaderFocusable()); info.setFocused(isFocused()); info.setFocused(isFocused()); info.setAccessibilityFocused(isAccessibilityFocused()); info.setAccessibilityFocused(isAccessibilityFocused()); info.setSelected(isSelected()); info.setSelected(isSelected()); Loading Loading @@ -10349,6 +10362,45 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return FOCUSABLE_IN_TOUCH_MODE == (mViewFlags & FOCUSABLE_IN_TOUCH_MODE); return FOCUSABLE_IN_TOUCH_MODE == (mViewFlags & FOCUSABLE_IN_TOUCH_MODE); } } /** * Returns whether the view should be treated as a focusable unit by screen reader * accessibility tools. * @see #setScreenReaderFocusable(boolean) * * @return Whether the view should be treated as a focusable unit by screen reader. */ public boolean isScreenReaderFocusable() { return (mPrivateFlags3 & PFLAG3_SCREEN_READER_FOCUSABLE) != 0; } /** * When screen readers (one type of accessibility tool) decide what should be read to the * user, they typically look for input focusable ({@link #isFocusable()}) parents of * non-focusable text items, and read those focusable parents and their non-focusable children * as a unit. In some situations, this behavior is desirable for views that should not take * input focus. Setting an item to be screen reader focusable requests that the view be * treated as a unit by screen readers without any effect on input focusability. The default * value of {@code false} lets screen readers use other signals, like focusable, to determine * how to group items. * * @param screenReaderFocusable Whether the view should be treated as a unit by screen reader * accessibility tools. */ public void setScreenReaderFocusable(boolean screenReaderFocusable) { int pflags3 = mPrivateFlags3; if (screenReaderFocusable) { pflags3 |= PFLAG3_SCREEN_READER_FOCUSABLE; } else { pflags3 &= ~PFLAG3_SCREEN_READER_FOCUSABLE; } if (pflags3 != mPrivateFlags3) { mPrivateFlags3 = pflags3; notifyViewAccessibilityStateChangedIfNeeded( AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED); } } /** /** * Find the nearest view in the specified direction that can take focus. * Find the nearest view in the specified direction that can take focus. * This does not actually give focus to that view. * This does not actually give focus to that view.
core/java/android/view/ViewGroup.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2591,7 +2591,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager boolean alreadyDispatchedToNewTouchTarget = false; boolean alreadyDispatchedToNewTouchTarget = false; if (!canceled && !intercepted) { if (!canceled && !intercepted) { // If the event is targeting accessiiblity focus we give it to the // If the event is targeting accessibility focus we give it to the // view that has accessibility focus and if it does not handle it // view that has accessibility focus and if it does not handle it // we clear the flag and dispatch the event to all children as usual. // we clear the flag and dispatch the event to all children as usual. // We are looking up the accessibility focused host to avoid keeping // We are looking up the accessibility focused host to avoid keeping Loading
core/java/android/view/accessibility/AccessibilityNodeInfo.java +33 −0 Original line number Original line Diff line number Diff line Loading @@ -635,6 +635,8 @@ public class AccessibilityNodeInfo implements Parcelable { private static final int BOOLEAN_PROPERTY_IMPORTANCE = 0x0040000; private static final int BOOLEAN_PROPERTY_IMPORTANCE = 0x0040000; private static final int BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE = 0x0080000; private static final int BOOLEAN_PROPERTY_IS_SHOWING_HINT = 0x0100000; private static final int BOOLEAN_PROPERTY_IS_SHOWING_HINT = 0x0100000; /** /** Loading Loading @@ -2320,6 +2322,37 @@ public class AccessibilityNodeInfo implements Parcelable { setBooleanProperty(BOOLEAN_PROPERTY_IMPORTANCE, important); setBooleanProperty(BOOLEAN_PROPERTY_IMPORTANCE, important); } } /** * Returns whether the node is explicitly marked as a focusable unit by a screen reader. Note * that {@code false} indicates that it is not explicitly marked, not that the node is not * a focusable unit. Screen readers should generally used other signals, such as * {@link #isFocusable()}, or the presence of text in a node, to determine what should receive * focus. * * @return {@code true} if the node is specifically marked as a focusable unit for screen * readers, {@code false} otherwise. * * @see View#isScreenReaderFocusable() */ public boolean isScreenReaderFocusable() { return getBooleanProperty(BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE); } /** * Sets whether the node should be considered a focusable unit by a screen reader. * <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 screenReaderFocusable {@code true} if the node is a focusable unit for screen readers, * {@code false} otherwise. */ public void setScreenReaderFocusable(boolean screenReaderFocusable) { setBooleanProperty(BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE, screenReaderFocusable); } /** /** * Returns whether the node's text represents a hint for the user to enter text. It should only * Returns whether the node's text represents a hint for the user to enter text. It should only * be {@code true} if the node has editable text. * be {@code true} if the node has editable text. Loading
core/res/res/values/attrs.xml +6 −0 Original line number Original line Diff line number Diff line Loading @@ -3021,6 +3021,12 @@ <!-- Whether this View should use a default focus highlight when it gets focused but <!-- Whether this View should use a default focus highlight when it gets focused but doesn't have {@link android.R.attr#state_focused} defined in its background. --> doesn't have {@link android.R.attr#state_focused} defined in its background. --> <attr name="defaultFocusHighlightEnabled" format="boolean" /> <attr name="defaultFocusHighlightEnabled" format="boolean" /> <!-- Whether this view should be treated as a focusable unit by screen reader accessibility tools. See {@link android.view.View#setScreenReaderFocusable(boolean)}. The default value, {@code false}, leaves the screen reader to consider other signals, such as focusability or the presence of text, to decide what it focus.--> <attr name="screenReaderFocusable" format="boolean" /> </declare-styleable> </declare-styleable> <!-- Attributes that can be assigned to a tag for a particular View. --> <!-- Attributes that can be assigned to a tag for a particular View. --> Loading