From fc19cebef964ff87ebdf59d99fd50c06197896c2 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Sun, 7 Jun 2020 14:26:08 -0700 Subject: [PATCH] Fix a11y count for overflow bubbles Fixes: 157754687 Test: TalkBack says correct bubble count when overflow bubbles <= columns and when bubbles > columns Change-Id: I906a430518db71ae6a53d4d302051121621d7439 --- .../systemui/bubbles/BubbleOverflowActivity.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java index 3e694b9f5d2a4..b4672c14b49a3 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java @@ -75,6 +75,20 @@ public class BubbleOverflowActivity extends Activity { } return false; } + + @Override + public int getColumnCountForAccessibility(RecyclerView.Recycler recycler, + RecyclerView.State state) { + int bubbleCount = state.getItemCount(); + int columnCount = super.getColumnCountForAccessibility(recycler, state); + if (bubbleCount < columnCount) { + // If there are 4 columns and bubbles <= 3, + // TalkBack says "AppName 1 of 4 in list 4 items" + // This is a workaround until TalkBack bug is fixed for GridLayoutManager + return bubbleCount; + } + return columnCount; + } } @Inject