diff options
| author | Eugene Susla <eugenesusla@google.com> | 2018-04-10 20:18:09 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-10 20:18:09 +0000 |
| commit | fd34bcc397d53ebccb699df360cc995ddb677bd8 (patch) | |
| tree | 7716c3755b7b30963684ff5ef54e03ed7160a1fd /core/java/android/view/View.java | |
| parent | 02db955ed8b944bf13b135b73275301b2c39491d (diff) | |
| parent | 9af1378c82c2e39c40383af117c568257152eee9 (diff) | |
Merge "[DO NOT MERGE] Avoid sending content changed a11y events from wrong views" into pi-dev
Diffstat (limited to 'core/java/android/view/View.java')
| -rw-r--r-- | core/java/android/view/View.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index dc58f11e83fd..b367dc7b9c50 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -11791,6 +11791,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return null; } + /** @hide */ + View getSelfOrParentImportantForA11y() { + if (isImportantForAccessibility()) return this; + ViewParent parent = getParentForAccessibility(); + if (parent instanceof View) return (View) parent; + return null; + } + /** * Adds the children of this View relevant for accessibility to the given list * as output. Since some Views are not important for accessibility the added @@ -15006,10 +15014,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, public void setAlpha(@FloatRange(from=0.0, to=1.0) float alpha) { ensureTransformationInfo(); if (mTransformationInfo.mAlpha != alpha) { - // Report visibility changes, which can affect children, to accessibility - if ((alpha == 0) ^ (mTransformationInfo.mAlpha == 0)) { - notifySubtreeAccessibilityStateChangedIfNeeded(); - } + float oldAlpha = mTransformationInfo.mAlpha; mTransformationInfo.mAlpha = alpha; if (onSetAlpha((int) (alpha * 255))) { mPrivateFlags |= PFLAG_ALPHA_SET; @@ -15021,6 +15026,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, invalidateViewProperty(true, false); mRenderNode.setAlpha(getFinalAlpha()); } + // Report visibility changes, which can affect children, to accessibility + if ((alpha == 0) ^ (oldAlpha == 0)) { + notifySubtreeAccessibilityStateChangedIfNeeded(); + } } } |
