diff options
author | Alan Viverette <alanv@google.com> | 2013-10-07 18:28:45 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2013-10-07 18:28:45 -0700 |
commit | 24cafbc56cacfad42af375e7545de45ff500cdbe (patch) | |
tree | 52e306faccfdea92014c8998602218bcd6d87128 /core/java/android/view | |
parent | 00fb27dda8c74229ea55b524063410842ba4a21e (diff) | |
download | frameworks_base-24cafbc56cacfad42af375e7545de45ff500cdbe.zip frameworks_base-24cafbc56cacfad42af375e7545de45ff500cdbe.tar.gz frameworks_base-24cafbc56cacfad42af375e7545de45ff500cdbe.tar.bz2 |
Fix HIDE_DESCENDANTS accessibility importance mode
Ensures accessibility framework is notified when subtree visibility
changes as a result of hiding descendants. Fixes collision between
HAS_TRANSIENT_STATE flag and IMPORTANT_FOR_ACCESSIBILITY mask.
BUG: 11087525
Change-Id: I92dba27350970a09e76b5a878c7604ea06cae197
Diffstat (limited to 'core/java/android/view')
-rw-r--r-- | core/java/android/view/View.java | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index caeb1d8..c45307b 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1738,47 +1738,41 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Masks for mPrivateFlags2, as generated by dumpFlags(): * - * -------|-------|-------|-------| - * PFLAG2_TEXT_ALIGNMENT_FLAGS[0] - * PFLAG2_TEXT_DIRECTION_FLAGS[0] - * 1 PFLAG2_DRAG_CAN_ACCEPT - * 1 PFLAG2_DRAG_HOVERED - * 1 PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT - * 11 PFLAG2_TEXT_DIRECTION_MASK_SHIFT - * 1 1 PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT - * 11 PFLAG2_LAYOUT_DIRECTION_MASK - * 11 1 PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT - * 1 PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL - * 1 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT - * 1 1 PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT - * 1 PFLAG2_LAYOUT_DIRECTION_RESOLVED - * 11 PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK - * 1 PFLAG2_TEXT_DIRECTION_FLAGS[1] - * 1 PFLAG2_TEXT_DIRECTION_FLAGS[2] - * 11 PFLAG2_TEXT_DIRECTION_FLAGS[3] - * 1 PFLAG2_TEXT_DIRECTION_FLAGS[4] - * 1 1 PFLAG2_TEXT_DIRECTION_FLAGS[5] - * 111 PFLAG2_TEXT_DIRECTION_MASK - * 1 PFLAG2_TEXT_DIRECTION_RESOLVED - * 1 PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT - * 111 PFLAG2_TEXT_DIRECTION_RESOLVED_MASK - * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[1] - * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[2] - * 11 PFLAG2_TEXT_ALIGNMENT_FLAGS[3] - * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[4] - * 1 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[5] - * 11 PFLAG2_TEXT_ALIGNMENT_FLAGS[6] - * 111 PFLAG2_TEXT_ALIGNMENT_MASK - * 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED - * 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT - * 111 PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK - * 11 PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK - * 1 PFLAG2_HAS_TRANSIENT_STATE - * 1 PFLAG2_ACCESSIBILITY_FOCUSED - * 1 PFLAG2_ACCESSIBILITY_STATE_CHANGED - * 1 PFLAG2_VIEW_QUICK_REJECTED - * 1 PFLAG2_PADDING_RESOLVED - * -------|-------|-------|-------| + * |-------|-------|-------|-------| + * 1 PFLAG2_DRAG_CAN_ACCEPT + * 1 PFLAG2_DRAG_HOVERED + * 11 PFLAG2_LAYOUT_DIRECTION_MASK + * 1 PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL + * 1 PFLAG2_LAYOUT_DIRECTION_RESOLVED + * 11 PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK + * 1 PFLAG2_TEXT_DIRECTION_FLAGS[1] + * 1 PFLAG2_TEXT_DIRECTION_FLAGS[2] + * 11 PFLAG2_TEXT_DIRECTION_FLAGS[3] + * 1 PFLAG2_TEXT_DIRECTION_FLAGS[4] + * 1 1 PFLAG2_TEXT_DIRECTION_FLAGS[5] + * 111 PFLAG2_TEXT_DIRECTION_MASK + * 1 PFLAG2_TEXT_DIRECTION_RESOLVED + * 1 PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT + * 111 PFLAG2_TEXT_DIRECTION_RESOLVED_MASK + * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[1] + * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[2] + * 11 PFLAG2_TEXT_ALIGNMENT_FLAGS[3] + * 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[4] + * 1 1 PFLAG2_TEXT_ALIGNMENT_FLAGS[5] + * 11 PFLAG2_TEXT_ALIGNMENT_FLAGS[6] + * 111 PFLAG2_TEXT_ALIGNMENT_MASK + * 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED + * 1 PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT + * 111 PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK + * 111 PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK + * 11 PFLAG2_ACCESSIBILITY_LIVE_REGION_MASK + * 1 PFLAG2_ACCESSIBILITY_FOCUSED + * 1 PFLAG2_SUBTREE_ACCESSIBILITY_STATE_CHANGED + * 1 PFLAG2_VIEW_QUICK_REJECTED + * 1 PFLAG2_PADDING_RESOLVED + * 1 PFLAG2_DRAWABLE_RESOLVED + * 1 PFLAG2_HAS_TRANSIENT_STATE + * |-------|-------|-------|-------| */ /** @@ -1876,15 +1870,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, static final int LAYOUT_DIRECTION_RESOLVED_DEFAULT = LAYOUT_DIRECTION_LTR; /** - * Indicates that the view is tracking some sort of transient state - * that the app should not need to be aware of, but that the framework - * should take special care to preserve. - * - * @hide - */ - static final int PFLAG2_HAS_TRANSIENT_STATE = 0x1 << 22; - - /** * Text direction is inherited thru {@link ViewGroup} */ public static final int TEXT_DIRECTION_INHERIT = 0; @@ -2216,6 +2201,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, static final int PFLAG2_DRAWABLE_RESOLVED = 0x40000000; /** + * Indicates that the view is tracking some sort of transient state + * that the app should not need to be aware of, but that the framework + * should take special care to preserve. + */ + static final int PFLAG2_HAS_TRANSIENT_STATE = 0x80000000; + + /** * Group of bits indicating that RTL properties resolution is done. */ static final int ALL_RTL_PROPERTIES_RESOLVED = PFLAG2_LAYOUT_DIRECTION_RESOLVED | @@ -7090,12 +7082,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #IMPORTANT_FOR_ACCESSIBILITY_AUTO */ public void setImportantForAccessibility(int mode) { - final boolean oldIncludeForAccessibility = includeForAccessibility(); - if (mode != getImportantForAccessibility()) { + final int oldMode = getImportantForAccessibility(); + if (mode != oldMode) { + // If we're moving between AUTO and another state, we might not need + // to send a subtree changed notification. We'll store the computed + // importance, since we'll need to check it later to make sure. + final boolean maySkipNotify = oldMode == IMPORTANT_FOR_ACCESSIBILITY_AUTO + || mode == IMPORTANT_FOR_ACCESSIBILITY_AUTO; + final boolean oldIncludeForAccessibility = maySkipNotify && includeForAccessibility(); mPrivateFlags2 &= ~PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK; mPrivateFlags2 |= (mode << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT) & PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_MASK; - if (oldIncludeForAccessibility != includeForAccessibility()) { + if (!maySkipNotify || oldIncludeForAccessibility != includeForAccessibility()) { notifySubtreeAccessibilityStateChangedIfNeeded(); } else { notifyViewAccessibilityStateChangedIfNeeded( |