summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-06-05 15:55:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-05 15:55:42 -0700
commitcab5b8a91d6fbcbb694284038f5529ff02f10f78 (patch)
treef918e92c404a56b5615add1222e5238f63d1d6f9 /core/java
parent35b691f056159e938a256420f6d3dec1ebf8bfd9 (diff)
parente47957a0bbe2164467ff6e7a566b0c9e4689cdc9 (diff)
Merge "Nodes with contentDescription should always be important for accessibility." into jb-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/View.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 48819a115c03..7c6a7c520b52 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3457,7 +3457,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
}
break;
case com.android.internal.R.styleable.View_contentDescription:
- mContentDescription = a.getString(attr);
+ setContentDescription(a.getString(attr));
break;
case com.android.internal.R.styleable.View_soundEffectsEnabled:
if (!a.getBoolean(attr, true)) {
@@ -5048,6 +5048,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
@RemotableViewMethod
public void setContentDescription(CharSequence contentDescription) {
mContentDescription = contentDescription;
+ final boolean nonEmptyDesc = contentDescription != null && contentDescription.length() > 0;
+ if (nonEmptyDesc && getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
+ setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
+ }
}
/**