From b708f7703b98e14f01311dbc93e2636abe4790c9 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Wed, 10 Oct 2012 21:25:55 -0700 Subject: 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 --- core/java/android/view/View.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/java/android/view/View.java') diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 0d76eac..6eafc57 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5214,11 +5214,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ @RemotableViewMethod public void setContentDescription(CharSequence contentDescription) { + if (mContentDescription == null) { + if (contentDescription == null) { + return; + } + } else if (mContentDescription.equals(contentDescription)) { + return; + } mContentDescription = contentDescription; final boolean nonEmptyDesc = contentDescription != null && contentDescription.length() > 0; if (nonEmptyDesc && getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } + notifyAccessibilityStateChanged(); } /** -- cgit v1.1