Nodes with contentDescription should always be important for accessibility.
1. Now after setting the content description on a view we mark is as
important for accessibility of the current important for accessibility
mode of that view is auto.
2. Minor tweak to a touch explorer coefficient to make performing double
tapping easier.
bug:6615353
Change-Id: I3b477f533a3ebde85d425caf32ace5e851240f88
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 48819a1..7c6a7c5 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3457,7 +3457,7 @@
}
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 @@
@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);
+ }
}
/**