From cd0a5c536a3ff152f1a5e2ad76b30d26ea0f4a60 Mon Sep 17 00:00:00 2001 From: sallyyuen Date: Tue, 22 Oct 2019 09:27:27 -0700 Subject: [PATCH] Fix TalkBack page announcments in RecentsView Because a PagedView has page a11y actions (PAGE_LEFT/RIGHT), a11y services now identify recents apps as a pager. Tweak the a11y event info to accomodate this so the announcements are correct. Also fix the CollectionItemInfo to have the correct page index. Bug: 141899192 Test: Tested with TalkBack on device Change-Id: Ic578bee8de26a41f0ab0e5468f1fd060ed21a7e1 --- .../src/com/android/quickstep/views/RecentsView.java | 4 ++-- .../src/com/android/quickstep/views/TaskView.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 5d4665d48a..c634825ea6 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -1673,8 +1673,8 @@ public abstract class RecentsView extends PagedView impl if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) { final int[] visibleTasks = getVisibleChildrenRange(); - event.setFromIndex(taskViewCount - visibleTasks[1] - 1); - event.setToIndex(taskViewCount - visibleTasks[0] - 1); + event.setFromIndex(taskViewCount - visibleTasks[1]); + event.setToIndex(taskViewCount - visibleTasks[0]); event.setItemCount(taskViewCount); } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 3af0f705d3..2b8e87f05e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -728,8 +728,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { final RecentsView recentsView = getRecentsView(); final AccessibilityNodeInfo.CollectionItemInfo itemInfo = AccessibilityNodeInfo.CollectionItemInfo.obtain( - 0, 1, recentsView.getChildCount() - recentsView.indexOfChild(this) - 1, 1, - false); + 0, 1, recentsView.getTaskViewCount() - recentsView.indexOfChild(this) - 1, + 1, false); info.setCollectionItemInfo(itemInfo); }