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
This commit is contained in:
sallyyuen
2019-10-22 09:27:27 -07:00
committed by Sally Yuen
parent f6d504d4cb
commit cd0a5c536a
2 changed files with 4 additions and 4 deletions
@@ -1673,8 +1673,8 @@ public abstract class RecentsView<T extends BaseActivity> 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);
}
}
@@ -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);
}