Skip to content

Commit b708f77

Browse files
committed
Send accessibility event for content change upon setting content description.
1. Since the content description is generated dynamically we need to notify clients when it changes so they can drop cached state to get the most recent content. This really is used by the caching we do to optimize the window query APIs. Otherwise, the user does not see the current content. bug:7327556 Change-Id: I9be46508e86864566e027c64565eb1d787ec9363
1 parent 2514456 commit b708f77

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/java/android/view/View.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5214,11 +5214,19 @@ public CharSequence getContentDescription() {
52145214
*/
52155215
@RemotableViewMethod
52165216
public void setContentDescription(CharSequence contentDescription) {
5217+
if (mContentDescription == null) {
5218+
if (contentDescription == null) {
5219+
return;
5220+
}
5221+
} else if (mContentDescription.equals(contentDescription)) {
5222+
return;
5223+
}
52175224
mContentDescription = contentDescription;
52185225
final boolean nonEmptyDesc = contentDescription != null && contentDescription.length() > 0;
52195226
if (nonEmptyDesc && getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
52205227
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
52215228
}
5229+
notifyAccessibilityStateChanged();
52225230
}
52235231

52245232
/**

0 commit comments

Comments
 (0)