From 7aa2e1f1948bbddcec5e1edf08e2173171c9bfb7 Mon Sep 17 00:00:00 2001 From: yingleiw Date: Tue, 17 Sep 2019 11:04:13 -0700 Subject: [PATCH] Use -1 for ListView CollectionInfo Talkback is supposed to announce the number of "accessibility" items, and some views from the adapter may set importance for accessibility to no. Or one view may contain several children views. This is consistent with what the recyclerview is currently doing. Bug: 140313418 Test: after the change, talkback doesn't announce the number of items in a list. Everything else remains the same. Change-Id: Id05d96562e523ebd746ac4dbb652b0b15bf366a6 --- core/java/android/widget/ListView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 2f44d6ee88b1e..1cb114856a4ac 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -4109,7 +4109,7 @@ public class ListView extends AbsListView { final int rowsCount = getCount(); final int selectionMode = getSelectionModeForAccessibility(); final CollectionInfo collectionInfo = CollectionInfo.obtain( - rowsCount, 1, false, selectionMode); + -1, -1, false, selectionMode); info.setCollectionInfo(collectionInfo); if (rowsCount > 0) {