am b3c2b21b: Merge "Accessibility should not query for list items when data set changed." into jb-mr2-dev

* commit 'b3c2b21b5ba30d82938ae2ef93d8120f5fd0cc80':
  Accessibility should not query for list items when data set changed.
This commit is contained in:
Svetoslav
2013-05-10 13:10:41 -07:00
committed by Android Git Automerger
3 changed files with 21 additions and 2 deletions

View File

@@ -15435,8 +15435,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @param accessibilityId The accessibility id.
* @return The found view.
*
* @hide
*/
View findViewByAccessibilityIdTraversal(int accessibilityId) {
public View findViewByAccessibilityIdTraversal(int accessibilityId) {
if (getAccessibilityViewId() == accessibilityId) {
return this;
}

View File

@@ -933,8 +933,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
}
/** @hide */
@Override
View findViewByAccessibilityIdTraversal(int accessibilityId) {
public View findViewByAccessibilityIdTraversal(int accessibilityId) {
View foundView = super.findViewByAccessibilityIdTraversal(accessibilityId);
if (foundView != null) {
return foundView;

View File

@@ -1407,6 +1407,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
return false;
}
/** @hide */
@Override
public View findViewByAccessibilityIdTraversal(int accessibilityId) {
if (accessibilityId == getAccessibilityViewId()) {
return this;
}
// If the data changed the children are invalid since the data model changed.
// Hence, we pretend they do not exist. After a layout the children will sync
// with the model at which point we notify that the accessibility state changed,
// so a service will be able to re-fetch the views.
if (mDataChanged) {
return null;
}
return super.findViewByAccessibilityIdTraversal(accessibilityId);
}
/**
* Indicates whether the children's drawing cache is used during a scroll.
* By default, the drawing cache is enabled but this will consume more memory.